Skip to content

Instantly share code, notes, and snippets.

@sscovil
Created October 5, 2016 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sscovil/700aba8e50469e9ec83256490c2b0076 to your computer and use it in GitHub Desktop.
Save sscovil/700aba8e50469e9ec83256490c2b0076 to your computer and use it in GitHub Desktop.
Shallow (non-recursive) object key-to-camelCase mapper Lodash mixin
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