New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

arraymania

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arraymania

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

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

ArrayMania

it has two features for now one is flatArray and second is deep sorting

flatArray

It accepts nested array and convert it into single dimension array

deepSort

It accepts nested array and objects and sort them

Installation

npm i arraymania --save Then...


const { deepSorting, flatArray , getObjValueByPath } = require("arraymania")
let dummy = [
  "a",
  [[[[[[[["john"]]]]]]]],
  ["bab", [["ded"], "cdd"]],
  "s",
  {
    key2: "asd",
    key1: [45, 78, 12],
  },
  ["a", "s", ["z", "s"]],
];

console.log("one dimension array", flatArray(dummy))
//output
//
[ 'a',
  'john',
  'bab',
  'ded',
  'cdd',
  's',
  { key2: 'asd', key1: [ 45, 78, 12 ] },
  'a',
  's',
  'z',
  's' ]

console.log("sorted array/Object", deepSorting(dummy))
//output
//   [{"key1":[12,45,78],"key2":"asd"},"a",["a","s",["s","z"]],["bab",["cdd",["ded"]]],[[[[[[[["john"]]]]]]]],"s"]

let obj = {
  obj1: {
    obj2: {
      arr: [
        {
          key1: "john",
        },
      ],
    },
  },
};
let a = getObjValueByPath(obj, "obj1.obj2.arr[0].key1");
console.log("a: ", a);
//output a:  john

Keywords

npm

FAQs

Package last updated on 25 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts