MCPcopy Index your code
hub / github.com/reactjs/react-rails / isKeyword

Function isKeyword

lib/assets/javascripts/JSXTransformer.js:2737–2772  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

2735 // 7.6.1.1 Keywords
2736
2737 function isKeyword(id) {
2738 if (strict && isStrictModeReservedWord(id)) {
2739 return true;
2740 }
2741
2742 // 'const' is specialized as Keyword in V8.
2743 // 'yield' is only treated as a keyword in strict mode.
2744 // 'let' is for compatiblity with SpiderMonkey and ES.next.
2745 // Some others are from future reserved words.
2746
2747 switch (id.length) {
2748 case 2:
2749 return (id === 'if') || (id === 'in') || (id === 'do');
2750 case 3:
2751 return (id === 'var') || (id === 'for') || (id === 'new') ||
2752 (id === 'try') || (id === 'let');
2753 case 4:
2754 return (id === 'this') || (id === 'else') || (id === 'case') ||
2755 (id === 'void') || (id === 'with') || (id === 'enum');
2756 case 5:
2757 return (id === 'while') || (id === 'break') || (id === 'catch') ||
2758 (id === 'throw') || (id === 'const') ||
2759 (id === 'class') || (id === 'super');
2760 case 6:
2761 return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
2762 (id === 'switch') || (id === 'export') || (id === 'import');
2763 case 7:
2764 return (id === 'default') || (id === 'finally') || (id === 'extends');
2765 case 8:
2766 return (id === 'function') || (id === 'continue') || (id === 'debugger');
2767 case 10:
2768 return (id === 'instanceof');
2769 default:
2770 return false;
2771 }
2772 }
2773
2774 // 7.4 Comments
2775

Callers 1

scanIdentifierFunction · 0.85

Calls 1

isStrictModeReservedWordFunction · 0.85

Tested by

no test coverage detected