Deep pluck ref finds the desired properties and plucks the parent object reference.
$ npm install deep-pluck-ref
import deepPluckRef from 'deep-pluck-ref';
const obj = {
do: {
all: {
the: {
things: [
{
thing: 'one',
value: 'thing one value'
},
{
thing: 'two',
value: 'thing two value'
},
{
thing: 'three'
}
]
}
}
}
};
const results = deepPluckRef(obj, ['value']);
// [ { thing: 'one', value: 'thing one value' },
// { { thing: 'two', value: 'thing two value' } ]