Skip to content

Instantly share code, notes, and snippets.

@raduGaspar
Created October 24, 2016 17:10
Show Gist options
  • Save raduGaspar/9d9e9d5001ab01d0ba37dd317a9a97d3 to your computer and use it in GitHub Desktop.
Save raduGaspar/9d9e9d5001ab01d0ba37dd317a9a97d3 to your computer and use it in GitHub Desktop.
export default class Utils {
constructor() {
let e = new Error('is a static class, no need to instantiate!');
e.name = 'Utils';
throw e.toString();
}
static toCamelCase(str) {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) {
return index == 0 ? letter.toLowerCase() : letter.toUpperCase();
}).replace(/(\s|-|_)+/g, '');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment