UNPKG

label-studio

Version:

Data Labeling Tool that is backend agnostic and can be embedded into your applications

22 lines (17 loc) 469 B
import { _index } from "../Template"; const objToInd = { a: { b: { c: 10 } } }; it("Template function index", () => { expect(_index(objToInd, "a.b.c")).toBe(10); }); /** * Works with both strings and lists */ it("Template function index", () => { expect(_index(objToInd, ["a", "b", "c"])).toBe(10); }); /** * Setter-mode - third argument (possibly poor form) */ it("Template function index", () => { expect(_index(objToInd, "a.b.c", 123)).toBe(123); });