recursive-entries

1.0.1 • Public • Published

♻ Recursive Entries

GitHub forks GitHub stars bundle size npm downloads

Object.entries, but recursively ;)

⬇ Installation

npm i recursive-entries

🛠 Usage

const {recursiveEntries, valueFromPath} = require('recursive-entries');

💡 Pro-tip: Utilize the test file as an example

📃 Documentation

recursiveEntries(obj)

  • where obj is any vanilla object
  • returns an array of length 2 arrays, where the first item is an array of keys leading to the value and the second item is the value found at the end of the path; for example, [ [["path", "to"], "value"], ... ]

valueFromPath(obj, path)

  • where obj is any vanilla object
  • where path is an array of keys
  • returns value found at the end of the path
  • returns undefined if the path does not exist

Engineered with 💖 by @EthanThatOneKid

Package Sidebar

Install

npm i recursive-entries

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

4.84 kB

Total Files

5

Last publish

Collaborators

  • ethanthatonekid