forked from javascript-obfuscator/javascript-obfuscator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeadCodeInjectionRule.ts
More file actions
29 lines (24 loc) · 788 Bytes
/
Copy pathDeadCodeInjectionRule.ts
File metadata and controls
29 lines (24 loc) · 788 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
import { TOptionsNormalizerRule } from '../../types/options/TOptionsNormalizerRule';
import { IOptions } from '../../interfaces/options/IOptions';
import { DEFAULT_PRESET } from '../presets/Default';
/**
* @param {IOptions} options
* @returns {IOptions}
*/
export const DeadCodeInjectionRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
if (options.deadCodeInjection) {
options = {
...options,
deadCodeInjection: true,
stringArray: true
};
if (!options.stringArrayThreshold) {
options = {
...options,
stringArray: true,
stringArrayThreshold: <number>DEFAULT_PRESET.stringArrayThreshold
};
}
}
return options;
};