• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

javascript-obfuscator / javascript-obfuscator / 13621494893

15 Jun 2024 05:29PM CUT coverage: 97.297%. Remained the same
13621494893

push

github

web-flow
Update CHANGELOG.md

2238 of 2373 branches covered (94.31%)

Branch coverage included in aggregate %.

5645 of 5729 relevant lines covered (98.53%)

33055580.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/src/custom-code-helpers/CustomCodeHelperObfuscator.ts
1
import { inject, injectable } from 'inversify';
6✔
2
import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
6✔
3

4
import { TInputOptions } from '../types/options/TInputOptions';
5

6
import { ICustomCodeHelperObfuscator } from '../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
7
import { IOptions } from '../interfaces/options/IOptions';
8
import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
9

10
import { NO_ADDITIONAL_NODES_PRESET } from '../options/presets/NoCustomNodes';
6✔
11

12
import { JavaScriptObfuscator } from '../JavaScriptObfuscatorFacade';
6✔
13

14
@injectable()
15
export class CustomCodeHelperObfuscator implements ICustomCodeHelperObfuscator {
6✔
16
    /**
17
     * @type {IOptions}
18
     */
19
    private readonly options: IOptions;
20

21
    /**
22
     * @type {IRandomGenerator}
23
     */
24
    private readonly randomGenerator: IRandomGenerator;
25

26
    /**
27
     * @param {IRandomGenerator} randomGenerator
28
     * @param {IOptions} options
29
     */
30
    public constructor (
31
        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
32
        @inject(ServiceIdentifiers.IOptions) options: IOptions
33
    ) {
34
        this.randomGenerator = randomGenerator;
83,432✔
35
        this.options = options;
83,432✔
36
    }
37

38
    /**
39
     * @param {string} template
40
     * @param {TInputOptions} additionalOptions
41
     * @returns {string}
42
     */
43
    public obfuscateTemplate (template: string, additionalOptions: TInputOptions = {}): string {
×
44
        return JavaScriptObfuscator.obfuscate(
85,940✔
45
            template,
46
            {
47
                ...NO_ADDITIONAL_NODES_PRESET,
48
                identifierNamesGenerator: this.options.identifierNamesGenerator,
49
                identifiersDictionary: this.options.identifiersDictionary,
50
                numbersToExpressions: this.options.numbersToExpressions,
51
                simplify: this.options.simplify,
52
                seed: this.randomGenerator.getRawSeed(),
53
                ...additionalOptions
54
            }
55
        ).getObfuscatedCode();
56
    }
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc