object-rename
Rename an object's keys using a map
const rename = var object = foo: 3 bar: 42 baz: 101 var keymap = foo: 'lorem' bar: 'ipsum' var result = console // -> { lorem: 3, ipsum: 42, baz: 101 }
This module exports the rename
function, which takes two arguments:
object
: The object whose keys are to be renamedkeymap
: An map-like object whose keys correspond to the new keys to be renamed to
rename
returns a copy of object
with the keys renamed as described by keymap
.
install
npm install object-rename
license
MIT