source: trip-planner-front/node_modules/@babel/helper-validator-identifier/lib/keyword.js@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.isReservedWord = isReservedWord;
7exports.isStrictReservedWord = isStrictReservedWord;
8exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
9exports.isStrictBindReservedWord = isStrictBindReservedWord;
10exports.isKeyword = isKeyword;
11const reservedWords = {
12 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"],
13 strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
14 strictBind: ["eval", "arguments"]
15};
16const keywords = new Set(reservedWords.keyword);
17const reservedWordsStrictSet = new Set(reservedWords.strict);
18const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
19
20function isReservedWord(word, inModule) {
21 return inModule && word === "await" || word === "enum";
22}
23
24function isStrictReservedWord(word, inModule) {
25 return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
26}
27
28function isStrictBindOnlyReservedWord(word) {
29 return reservedWordsStrictBindSet.has(word);
30}
31
32function isStrictBindReservedWord(word, inModule) {
33 return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
34}
35
36function isKeyword(word) {
37 return keywords.has(word);
38}
Note: See TracBrowser for help on using the repository browser.