You can also try regex.
camelize = s => s.replace(/-./g, x=>x[1].toUpperCase())
const camelize = s => s.replace(/-./g, x=>x[1].toUpperCase())
const words = ["stack-overflow","camel-case","alllowercase","allcapitalletters","custom-xml-parser","api-finder","json-response-data","person20-address","user-api20-endpoint"];
console.log(words.map(camelize));
Looks only for hyphen followed by any character, and capitalises it and replaces the hyphen+character with the capitalised character.