Advertisement
Guest User

Untitled

a guest
May 28th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. /**
  2. * This is module to test.
  3. */
  4. module.exports = {
  5. camelCase: function(string) {
  6. return string.replace(/-[a-z]/g, function(match) {
  7. return match[1].toUpperCase() + match.slice(2);
  8. });
  9. },
  10. dashSeparated: function(string) {
  11. // Added [0-9]+ regex to add dash before numbers.
  12. return string.replace(/[A-Z]|[0-9]+/g, function(match) {
  13. return '-' + match.toLowerCase();
  14. });
  15. }
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement