find-deeper-keys
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

find-deeper-keys

Retrieve all values associated with a particular key in a nested object.

Install

npm install --save find-deeper-keys

Running tests

npm install
npm run test

Usage

var findDeeperKeys = require('find-deeper-keys')

var obj = { 
    key: "1", 
    b: { key: "2" }, 
    c: { d: { key: "3" } }, 
    e: { f: { g: { key: "4" } } } 
};
var target = 'key';

findDeeperKeys(obj, target)


> ["1", "2", "3", "4"]

Author

Ilyass Mabrouk

License

MIT

Package Sidebar

Install

npm i find-deeper-keys

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

3.19 kB

Total Files

5

Last publish

Collaborators

  • ilyassmabrouk