lodash-pickdeep

1.0.2 • Public • Published

lodash-pickDeep

GitHub Latest Release Build Status Coverage Status Dependency Status Dev Dependency Status

A lodash mixin to add a pickDeep function.

Install

$ npm install --save lodash-pickdeep

Usage

Using it as a lodash mixin

var _ = require('lodash');
var pickDeep = require('lodash-pickdeep');
 
_.mixin( { pickDeep: pickDeep }, { chain: true } );
 
_.pickDeep( { a: { b: { c: 'foo', d: 'bar', e: { f: 'baz' } } } }, [ 'a.b.c', 'a.b.e' ] );
// =>  { a: { b: { c: 'foo', e: { f: 'baz' } } } }

Using it on its own

var pickDeep = require('lodash-pickdeep');
 
pickDeep( { a: { b: { c: 'foo', d: 'bar', e: { f: 'baz' } } } }, [ 'a.b.c', 'a.b.e' ] );
// =>  { a: { b: { c: 'foo', e: { f: 'baz' } } } }

API Documentation

_.pickDeep(object, [props])

Creates an object composed of the picked object properties, which may contain deep property identifiers.

Arguments

  1. object (Object): The source object.
  2. [props] (...(string|string[]): The property identifiers to pick, specified individually or in arrays.

Returns

(Object): Returns the new object.

License

Copyright (c) 2016, James M. Greene (MIT License)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    122,773
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    122,773
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i lodash-pickdeep

Weekly Downloads

122,774

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jamesmgreene