Skip to content

Instantly share code, notes, and snippets.

@turbo
Created August 17, 2017 19:28
Show Gist options
  • Save turbo/7bd8b57375af3f0d6a3279cbe9a53e3e to your computer and use it in GitHub Desktop.
Save turbo/7bd8b57375af3f0d6a3279cbe9a53e3e to your computer and use it in GitHub Desktop.
normalizeCase = (mixed, clean = {}) => (
Object
.keys(mixed)
.map(
c => clean[c.toLowerCase()] =
mixed[c] instanceof Object
? normalizeCase(mixed[c])
: mixed[c]
),
clean
)
console.log(normalizeCase({
CamelCase: "Blah",
name: "egerihor",
props: {
john: 4,
PascaL: "nope"
}
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment