object-slice
v1.0.1
Published
Slice Objects into subsets, similar to Ruby's behaviour
Downloads
3
Maintainers
Readme
Object Slice
object-slice creates subsets of objects in a similar fashion Ruby does with .splice();
Installation
npm install --save object-slice
or
yarn add object-slice
Usage
Method Version
import sliceObject from 'object-slice';
const params = {
firstName: 'Von',
lastName: 'Eldritch',
email: '[email protected]',
birthday: '1959'
};
const justNames = sliceObject(params, 'firstName', 'lastName');
// justNames = { firstName: 'Von', lastName: 'Eldritch '}
ProtoType Version
import 'object-slice/lib/injectSliceObject';
const params = {
firstName: 'Von',
lastName: 'Eldritch',
email: '[email protected]',
birthday: '1959'
};
const justNames = params.slice('firstName', 'lastName');
// justNames = { firstName: 'Von', lastName: 'Eldritch '}
Contributing
Your contributions are welcome!
Author
License
MIT