pickapart
deep immutable destructuring with omit
- If your app is already using
Lodash
, then just use thelodash-pickapart
mixin.
Installation
$ npm install --save pickapart
Usage
const pickapart = ; // pickapart(paths, source)// * paths: String|Array (optional, if source is an Array)// * source: Object|Array const payload = name: 'abc' meta: token: 123 easy: true ; const token data = ;console;// => { name: 'abc', meta: { token: 123, easy: true }}console;// => 123console;// => { name: 'abc', meta: { easy: true }} const is ez = ;console;// => 'abc'console;// => true const flavors = 'chocolate' 'vanilla' 'strawberry'; const plain others = ;console;// => 'vanilla'console;// => [ 'chocolate', 'strawberry' ] const choco notChoco = ; console;// => 'chocolate'console;// => [ 'vanilla', 'strawberry' ]
License
ISC © Buster Collings