Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created March 22, 2017 18:34
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 miguelmota/e3e12b612f77d59a949392c35856a583 to your computer and use it in GitHub Desktop.
Save miguelmota/e3e12b612f77d59a949392c35856a583 to your computer and use it in GitHub Desktop.
JavaScript lodash capitalize all words
import _ from 'lodash';
export default function capitalize(s) {
// lodash only capitalizes first word
return _.snakeCase(s).split(`_`).map(x => _.capitalize(x)).join(` `);
}
@haimleibovitc
Copy link

_.isEmpty('')

@haimleibovitc
Copy link

return _.isEmpty('')

@haimleibovitc
Copy link

return _. snakeCase(''333 w3")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment