distinctiomagnam
Version:
JavaScript Obfuscation Tool.
62 lines (59 loc) • 1.16 kB
text/typescript
export const OPERATOR_PRECEDENCE = {
"||": 3,
"&&": 4,
"|": 5,
"^": 6,
"&": 7,
"==": 8,
"!=": 8,
"===": 8,
"!==": 8,
"<": 9,
">": 9,
"<=": 9,
">=": 9,
in: 9,
instanceof: 9,
"<<": 10,
">>": 10,
">>>": 10,
"+": 11,
"-": 11,
"*": 12,
"%": 12,
"/": 12,
"**": 13,
};
// Enables parenthesis regardless of precedence
export const NEEDS_PARENTHESES = 17;
export const EXPRESSIONS_PRECEDENCE = {
// Definitions
ArrayExpression: 20,
TaggedTemplateExpression: 20,
ThisExpression: 20,
Identifier: 20,
Literal: 18,
TemplateLiteral: 20,
Super: 20,
SequenceExpression: 20,
// Operations
MemberExpression: 19,
ChainExpression: 19,
CallExpression: 19,
NewExpression: 19,
// Other definitions
ArrowFunctionExpression: NEEDS_PARENTHESES,
ClassExpression: NEEDS_PARENTHESES,
FunctionExpression: NEEDS_PARENTHESES,
ObjectExpression: NEEDS_PARENTHESES,
// Other operations
UpdateExpression: 16,
UnaryExpression: 15,
AwaitExpression: 15,
BinaryExpression: 14,
LogicalExpression: 13,
ConditionalExpression: 4,
AssignmentExpression: 3,
YieldExpression: 2,
RestElement: 1,
};