@util-funcs/pick
v0.0.3
Published
Pick properties of object and take a fresh one.
Downloads
3
Maintainers
Readme
pick
Pick properties from an object and take new one.
Getting Started
import pick from '@util-funcs/pick';
Installing
npm i @util-funcs/pick --save
or
yarn add @util-funcs/pick
Examples
const order = {product_name: 'Macbook Air', color: 'gray', qty: 2};
pick(order, ['product_name', 'price']); // {product_name: 'Macbook Air'}
pick(order, ['product_name', 'price'], true); // {product_name: 'Macbook Air', price: null}
const handler = (key) => key === 'price' ? 5.5 : '-';
pick(order, ['product_name', 'price'], handler); // {product_name: 'Macbook Air', price: 5.5}
Run tests
npm test
Built With
Versioning
We use SemVer for versioning.
Authors
- Ahmet ATAY - Initial work
License
This project is licensed under the MIT License - see the LICENSE.md file for details