@util-funcs/pick
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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

Package Sidebar

Install

npm i @util-funcs/pick

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

5.11 kB

Total Files

6

Last publish

Collaborators

  • atayahmet