8447602b29c30f3ac0026b83fc46d2312c364fbfd4e1a2f5a0c381441fa9160f3b3851bb228d5fa431ca72ab65b5a9261ae125ea61ad2613c073c55874c608 737 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toIdentifier;
  6. var _isValidIdentifier = require("../validators/isValidIdentifier.js");
  7. var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
  8. function toIdentifier(input) {
  9. input = input + "";
  10. let name = "";
  11. for (const c of input) {
  12. name += (0, _helperValidatorIdentifier.isIdentifierChar)(c.codePointAt(0)) ? c : "-";
  13. }
  14. name = name.replace(/^[-0-9]+/, "");
  15. name = name.replace(/[-\s]+(.)?/g, function (match, c) {
  16. return c ? c.toUpperCase() : "";
  17. });
  18. if (!(0, _isValidIdentifier.default)(name)) {
  19. name = `_${name}`;
  20. }
  21. return name || "_";
  22. }
  23. //# sourceMappingURL=toIdentifier.js.map