Skip to content

Instantly share code, notes, and snippets.

What's happening?

Gregorio Galante gregogalante

What's happening?
View GitHub Profile
gregogalante / SnakeToCamelCase.js
Last active Mar 5, 2018 — forked from emcmanus/snakeToCamelCase.js
ES6 module to recursively convert snake case keys in an object to camel case using lodash.
View SnakeToCamelCase.js
export function camelCaseKeys(object) {
let camelCaseObject = _.cloneDeep(object)
if (_.isArray(camelCaseObject)) {
return, camelCaseKeys)
if (_.isString(camelCaseObject)) {
return camelCaseObject
camelCaseObject = _.mapKeys(camelCaseObject, (value, key) => _.camelCase(key))
You can’t perform that action at this time.