decompose.js

1.0.5 • Public • Published

decompose.js

Build Status

Decompose a object.

Inspiration

read the next publicactión on stackoverflow. Would not it be great to know everything about an object? — This library allows it!!.

Example

const { decompose } = require('decompose.js')

const myObj = { a: { b: 0 }, c: [ { d: 1 }, { e: true } ] }

decompose( myObj ) // => Array
// [
//   [ []             , {"a":{"b":0},"c":[{"d":1},{"e":true}]} ],
//   [ ["a"]          , {"b":0}                                ],
//   [ ["a","b"]      , 0                                      ],
//   [ ["c"]          , [{"d":1},{"e":true}]                   ],
//   [ ["c","0"]      , {"d":1}                                ],
//   [ ["c","0","d"]  , 1                                      ],
//   [ ["c","1"]      , {"e":true}                             ],
//   [ ["c","1","e"]  , true                                   ],
//   [ ["c","length"] , 2                                      ]
// ]

Readme

Keywords

Package Sidebar

Install

npm i decompose.js

Weekly Downloads

1

Version

1.0.5

License

MIT

Last publish

Collaborators

  • jondotsoy