Created
October 5, 2016 22:46
-
-
Save sscovil/700aba8e50469e9ec83256490c2b0076 to your computer and use it in GitHub Desktop.
Shallow (non-recursive) object key-to-camelCase mapper Lodash mixin
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
const _ = require('lodash'); | |
function camelCaseKeys(obj) { | |
return _.mapKeys(obj, (value, key) => { | |
return _.camelCase(key); | |
}); | |
} | |
_.mixin({camelCaseKeys}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment