forked from javascript-obfuscator/javascript-obfuscator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeLiteralUtils.ts
More file actions
26 lines (21 loc) · 760 Bytes
/
Copy pathNodeLiteralUtils.ts
File metadata and controls
26 lines (21 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import * as ESTree from 'estree';
import { NodeGuards } from './NodeGuards';
export class NodeLiteralUtils {
/**
* @param {Literal} literalNode
* @param {Node} parentNode
* @returns {boolean}
*/
public static isProhibitedLiteralNode (literalNode: ESTree.Literal, parentNode: ESTree.Node): boolean {
if (NodeGuards.isPropertyNode(parentNode) && !parentNode.computed && parentNode.key === literalNode) {
return true;
}
if (NodeGuards.isImportDeclarationNode(parentNode)) {
return true;
}
if (NodeGuards.isExportAllDeclarationNode(parentNode) || NodeGuards.isExportNamedDeclarationNode(parentNode)) {
return true;
}
return false;
}
}