UNPKG

@enonic/js-utils

Version:
8 lines (7 loc) 237 B
export const camelize = ( str: string, removeRegex: RegExp = /\s+/g ): string => str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) { return index === 0 ? word.toLowerCase() : word.toUpperCase(); }).replace(removeRegex, '');