Skip to content

Rename the keys of a JavaScript Object simply by using a map/dict to do it

License

Notifications You must be signed in to change notification settings

daviddias/remap-keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remap-keys

Build Status Dependency Status js-standard-style

Rename the keys of a JavaScript Object simply by using a map/dict to do it

Usage

var remapKeys = require('remap-keys')

var obj = {
  data: 'aaah the data'
}

obj = remapKeys(obj, {
  data: 'newKey'
})

console.log(obj)
// { newKey: 'aaah the data'

Credits

While I was looking for a solution to remap keys in a JS obj, I found an incomplete version in Stack Overflow by tldr which I used as inspiration for this module.

About

Rename the keys of a JavaScript Object simply by using a map/dict to do it

Resources

License

Stars

Watchers

Forks

Packages

No packages published