translate-object
Translate an object representation into another based on a map.
Installation
Install the package with: npm install translate-object
.
Then:
var translate = ;
It hasn't been tested but should work fine on a browser. You can use it with browserify :).
Usage
It works with simple keys:
// => { key1: 'value' }
It works with nested keys:
// => { key1: 'here' }
It works with array indexes:
// => { key1: 'value' }
It works with mixed input:
// => { key1: 'value', key2: 'here', key3: 2 }
And the maps may be complex objects too:
// => { key1: [ 3, 'value' ], key2: { alternative: 'ugly', here: 'bleh' } }
License
Copyright (c) 2014 Pedro Yamada. Licensed under the MIT license.