camel-to-hyphen.js 220 B

12345678910
  1. "use strict";
  2. var replace = String.prototype.replace
  3. , re = /([A-Z])/g;
  4. module.exports = function () {
  5. var str = replace.call(this, re, "-$1").toLowerCase();
  6. if (str[0] === "-") str = str.slice(1);
  7. return str;
  8. };