Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default function toCamelCase(str) {
- return str
- .replace(/-/g, ' ')
- .replace(/_/g, ' ')
- .replace(/\s(.)/g, $1 => $1.toUpperCase())
- .replace(/\s/g, '')
- .replace(/^(.)/, $1 => $1.toLowerCase());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement