0.0.3 • Published 5 years ago

@util-funcs/pick v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

pick

Pick properties from an object and take new one.

npm version Build Status

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

License

This project is licensed under the MIT License - see the LICENSE.md file for details