Skip to content

Instantly share code, notes, and snippets.

@stonedem0
Last active October 22, 2019 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stonedem0/a51d2d5f6cc82b85ceb25e078675dec6 to your computer and use it in GitHub Desktop.
Save stonedem0/a51d2d5f6cc82b85ceb25e078675dec6 to your computer and use it in GitHub Desktop.
deep camel case
function deep(value) {
if (_.isPlainObject(value)) {
const obj = {}
for (let k in value) {
obj[_.camelCase(k)] = deep(value[k])
}
return obj
}
if (_.isArray(value)) {
return value.map(deep)
}
return value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment