UNPKG

arraymania

Version:

It make all the nested array into one dimension array and more functionalities will come soon

37 lines (34 loc) 769 B
const { flatArray } = require("./flatArray"); const { deepSorting } = require("./deepsorting"); const getObjValueByPath = require("./getObjPath"); // getObjPath let dummy = [ "a", [[[[[[[["john"]]]]]]]], ["bab", [["ded"], "cdd"]], "s", { key2: "asd", key1: [45, 78, 12], key3: null, key4: undefined, key5: false, }, ["a", "s", ["z", "s"]], ]; let obj = { obj1: { obj2: { arr: [ { key1: "john", }, ], }, }, }; // let a = getObjValueByPath(obj, "obj1.obj2.arr[0].key1"); // console.log("a: ", a); // console.log("one dimension array", flatArray(dummy)); // console.log("sortedarray", JSON.stringify(deepSorting(dummy))); module.exports = { deepSorting, flatArray, getObjValueByPath };