camel-case.js 279 B

12345678910111213
  1. 'use strict';
  2. function camelCase(str) {
  3. return str.replace(/[\w-]+/g, (s) =>
  4. /^-?[a-z]+(?:-[a-z]+)+$/.test(s)
  5. ? s
  6. .replace(/^-(ms|moz|khtml|epub|(\w+-?)*webkit)(?=-)/i, '$1')
  7. .replace(/-\w/g, (s) => s[1].toUpperCase())
  8. : s,
  9. );
  10. }
  11. module.exports = camelCase;