I would imagine this is a multiple part situation with regex, but how would you split a camelcase string at the capital letters turning them in to lowercase letters, and then adding a hyphen between each new string?
For example:
thisString
would become:
this-string
Try something like:
var myStr = 'thisString';
myStr = myStr.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();