Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

toIdentifier.js 698B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toIdentifier;
  6. var _isValidIdentifier = require("../validators/isValidIdentifier");
  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. }