1.0.1 • Published 5 years ago
@uppercod/get-prop v1.0.1
get-prop
Obtains the value of an object or array, according to a string or array type map.
install
npm install @uppercod/get-propusage
import getProp from "@uppercod/get-prop";
const data = {
a: {
b: {
c: {
d: "d",
},
},
},
};
getProp(data, "a.b.c.d"); // d
getProp(data, "f", "..."); //...Selector Map Syntax
a.b.cequivalent to selectordata.a.b.c.a.b[1]equivalent to selectordata.a.b[1].a/b/cequivalent to selectordata.a.b.c.["a","b","c"]equivalent to selectordata.a.b.c.