mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.isReservedWord = isReservedWord;
|
||
|
exports.isStrictReservedWord = isStrictReservedWord;
|
||
|
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
||
|
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
||
|
exports.isKeyword = isKeyword;
|
||
|
const reservedWords = {
|
||
|
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
||
|
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
||
|
strictBind: ["eval", "arguments"]
|
||
|
};
|
||
|
const keywords = new Set(reservedWords.keyword);
|
||
|
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
||
|
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
||
|
|
||
|
function isReservedWord(word, inModule) {
|
||
|
return inModule && word === "await" || word === "enum";
|
||
|
}
|
||
|
|
||
|
function isStrictReservedWord(word, inModule) {
|
||
|
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
||
|
}
|
||
|
|
||
|
function isStrictBindOnlyReservedWord(word) {
|
||
|
return reservedWordsStrictBindSet.has(word);
|
||
|
}
|
||
|
|
||
|
function isStrictBindReservedWord(word, inModule) {
|
||
|
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
||
|
}
|
||
|
|
||
|
function isKeyword(word) {
|
||
|
return keywords.has(word);
|
||
|
}
|