Sha256: 4904612738528287b538e29e53a1fdaa3dedc21ef87fc7ecfcafa36027b1a0af
Contents?: true
Size: 698 Bytes
Versions: 7
Compression:
Stored size: 698 Bytes
Contents
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = toIdentifier; var _isValidIdentifier = require("../validators/isValidIdentifier"); var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); function toIdentifier(input) { input = input + ""; let name = ""; for (const c of input) { name += (0, _helperValidatorIdentifier.isIdentifierChar)(c.codePointAt(0)) ? c : "-"; } name = name.replace(/^[-0-9]+/, ""); name = name.replace(/[-\s]+(.)?/g, function (match, c) { return c ? c.toUpperCase() : ""; }); if (!(0, _isValidIdentifier.default)(name)) { name = `_${name}`; } return name || "_"; }
Version data entries
7 entries across 7 versions & 1 rubygems