offers simple transformations for object literals
npm install oniyi-object-transform> offers simple transformations for object literals
``sh`
$ npm install --save oniyi-object-transform
`js
const transform = require('oniyi-object-transform');
`
Kind: global function
Returns: Object - result of transforms applied to params.source
| Param | Type | Description |
| --- | --- | --- |
| params | Object | describing the function arguments |
| params.source | Object | source object to be transformed. takes precendence over params.src |params.source
| [params.src] | Object | alias for |pick
| [params.target] | Object | target object to join the transformed source into |
| [params.method] | String | name of method to be used when joining results from and map. Options are: [merge, assign, defaults, defaultsDeep]. For details see lodash documentation: https://lodash.com/docs#assign |params.map
| [params.map] | Object | key => value map of source properties to be copied to target with a different name |
| [params.whitelist] | Array.<String> | list of strings that are allowed as values. This feature is helpful when you transform from one object to a specified schema and want to restrict target names of params.map to the list of schema keys |String
| [params.pick] | Array.<String> | properties to be picked from source and copied to target with the same name |
| [params.parse] | Object | key => value map of target properties to be run through value parsers. Value can be either of type to reference one of the built-in parsers [integer, date, lowercase, uppercase, trim] or of type Function` to be called with the original value as single argument. |
Apache-2.0 © [Benjamin Kroeger]()
[npm-image]: https://badge.fury.io/js/oniyi-object-transform.svg
[npm-url]: https://npmjs.org/package/oniyi-object-transform