object-key-prefixer
v1.0.2
Published
Prefix all keys in an object and return a new object with updated keys
Downloads
4
Readme
object-key-prefixer
A JavaScript object key prefixer
A simple method that takes an object and returns a new object where all of the top-level keys have been prefixed by some string.
Table of Contents
Install
npm install --save object-key-prefixer
Usage
var prefixer = require('object-key-prefixer');
var obj = {
one: 'foo',
two: {
bar: 'baz'
}
}
prefixer(obj, 'awesome_')
Output:
{
awesome_one: 'foo',
awesome_two: {
bar: 'baz'
}
}
Contribute
PRs accepted. Note that code uses standard styling.
License
MIT © Dan Caddigan