Last active
October 22, 2019 14:20
-
-
Save stonedem0/a51d2d5f6cc82b85ceb25e078675dec6 to your computer and use it in GitHub Desktop.
deep camel case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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