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.
22 lines
589 B
22 lines
589 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = isValidIdentifier;
|
|
|
|
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
|
|
|
function isValidIdentifier(name, reserved = true) {
|
|
if (typeof name !== "string") return false;
|
|
|
|
if (reserved) {
|
|
if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name)) {
|
|
return false;
|
|
} else if (name === "await") {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return (0, _helperValidatorIdentifier.isIdentifierName)(name);
|
|
} |