lodash helpers - rename (renames object keys)
/*
* var person = { firstName: 'bill', lastName: 'johnson' }
*
* person = _.rename(person, 'firstName', 'first')
* person = _.rename(person, 'lastName', 'last')
*
* console.log(person) // { first: 'bill', last: 'johnson' }
*/
_.rename = (obj, key, newKey) => {
if(_.includes(_.keys(obj), key)) {
obj[newKey] = _.clone(obj[key], true)
delete obj[key]
}
return obj
}