deep-pick-by
v1.0.0
Published
Recursively pick an object or an array by given criteria.
Downloads
888
Maintainers
Readme
deep-pick-by
Recursively pick an object or an array by given criteria.
Installation
npm install deep-pick-by --save
Usage
const deepPickBy = require('deep-pick-by');
const collection = {
a: 0,
b: 0,
c: {
a: 0,
b: 0,
c: {
a: 0,
b: 0,
},
},
};
deepPickBy(collection, (val, key) => key === 'a');
//=> { a: 0, c: { a: 0, c: { a: 0 } } }