Skip to content

Instantly share code, notes, and snippets.

@matijs matijs/camelCase.js
Last active Nov 3, 2016

What would you like to do?
Convert foo-bar-baz into a camelCased version
const camelCase = str => str.split( /[_,-]+/ ).map( ( item, index ) => index === 0 ? item : item.charAt(0).toUpperCase() + item.slice(1).toLowerCase()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.