For example suppose I always have a string that is delimited by \"-\". Is there a way to transform
it-is-a-great-day-today
to
itIsAGreatDayToday
'it-is-a-great-day-today'.split('-').map(function(x,i){ return (i?x[0].toUpperCase():x[0]) + x.slice(1).toLowerCase() }).join('')
Result:
'itIsAGreatDayToday'
Alternatively, .match(/\w+/g) rather than .split('-') -- depending on what you want to do in edge cases like "this--is-a-test".
.match(/\w+/g)
.split('-')