If you would use lodash instead of underscore, this would do:
_.mapKeys(obj, (v, k) => _.camelCase(k))
This would convert both TitleCase
and snake_case
to camelCase
. Note that it is not recursive though.
If you would use lodash instead of underscore, this would do:
_.mapKeys(obj, (v, k) => _.camelCase(k))
This would convert both TitleCase
and snake_case
to camelCase
. Note that it is not recursive though.