Skip to content

Instantly share code, notes, and snippets.

@chadedrupt
Created May 4, 2017 00:31
Show Gist options
  • Save chadedrupt/5ef892a5751184367b3e7f138d5d35eb to your computer and use it in GitHub Desktop.
Save chadedrupt/5ef892a5751184367b3e7f138d5d35eb to your computer and use it in GitHub Desktop.
import * as _ from 'lodash'
const camelize = (object: any): any => {
if (_.isArray(object)) return _.map(object, camelize)
if (_.isPlainObject(object)) return _.chain(object)
.mapKeys((value: any, key: any) => _.camelCase(key))
.mapValues((value: any) => camelize(value))
.value()
return object
}
export default camelize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment