change-keys
v1.0.2
Published
create a new object with modified keys from the original
Downloads
7
Maintainers
Readme
change-keys
a simple utility to get a new object with transformed property names.
##Usage
On a single object:
changeKeys({ x: 25, y: 0, opacity: 0.5 }, { x: 'left', y: 'top' })
//=> { left: 25, y: 0, opacity: 0.5 }
On a collection of objects:
changeKeys([
{ x: 5, y: 5, o: 0.5 },
{ x: 10, y: 10, o: 0.4 }
], { x: 'left', y: 'top' });
//=> [{ left: 5, top: 5, o: 0.5 },{ left: 10, top: 10, o: 0.4 }]
##License
MIT, see LICENSE.md for details.