recursive-entries
Version:
Object.entries, but recursively
33 lines (24 loc) • 1.47 kB
Markdown
[](https://github.com/EthanThatOneKid/recursive-entries/fork)
[][github]
[][npmpkg]
[][npmpkg]
> Object.entries, but recursively ;)
`npm i recursive-entries`
`const {recursiveEntries, valueFromPath} = require('recursive-entries');`
> 💡 Pro-tip: Utilize the [test file](test.js) as an example
* 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"], ... ]`
* 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](https://github.com/EthanThatOneKid)
[]: https://www.npmjs.com/package/recursive-entries
[]: https://github.com/EthanThatOneKid/recursive-entries