Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

deep-pluck-ref

Joshsteverson679ISC1.2.0

Deep pluck properties by returning their parent reference.

deeppluck, deep, pluck, reference, object

readme

Deep Pluck Ref

Contextual Deep Pluck

Deep pluck ref finds the desired properties and plucks the parent object reference.

Installation

$ npm install deep-pluck-ref

Usage

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' } ]