_map
Install
$ npm install --save lomap
Usage
const _map = const obj = foo: 123 bar: 456 // simple case: pick some fields// {foo: 123} // level up: pick with different name// {foo2: 123} // final move: pick and process with a handler function// {foo: 123}
API
_map(source, selection, [handler])
source
Type: object
Required: true
Source object.
selection
Type: array
object
An array of keys to select or key-value pair to set different to target object.
handler
Type: function
Default: val => val
Process each value with a handler function.
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D