forked from javascript-obfuscator/javascript-obfuscator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIdentifierNamesCacheRule.ts
More file actions
32 lines (26 loc) · 864 Bytes
/
Copy pathIdentifierNamesCacheRule.ts
File metadata and controls
32 lines (26 loc) · 864 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
27
28
29
30
31
32
import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
import { IOptions } from '../../interfaces/options/IOptions';
/**
* @param {IOptions} options
* @returns {IOptions}
*/
export const IdentifierNamesCacheRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
let identifierNamesCache = options.identifierNamesCache;
if (identifierNamesCache && !identifierNamesCache.globalIdentifiers) {
identifierNamesCache = {
...identifierNamesCache,
globalIdentifiers: {}
};
}
if (identifierNamesCache && !identifierNamesCache.propertyIdentifiers) {
identifierNamesCache = {
...identifierNamesCache,
propertyIdentifiers: {}
};
}
options = {
...options,
identifierNamesCache
};
return options;
};