Skip to content

hapticdata/change-keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

change-keys

a simple utility to get a new object with transformed property names.

NPM

##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.

About

small npm module for creating a new object with modified keys from the original

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published