(str: string)
| 2 | [...(str.trim().match(/\b(\w)/g) || '')].join('').toUpperCase(); |
| 3 | |
| 4 | export const dashToCamelCase = (str: string) => |
| 5 | str |
| 6 | .replace(/-([a-z])/g, (match, chr) => chr.toUpperCase()) |
| 7 | // remove leftover - which don't match the above regex. Like 'es-2015' |
| 8 | .replace(/-/g, '') |
| 9 | .replace(/^[A-Z]/, chr => chr.toLowerCase()); |