All files / src/node-transformers/node-obfuscators/replacers BooleanLiteralReplacer.ts

100% Statements 9/9
100% Branches 2/2
100% Functions 1/1
100% Lines 8/8
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 331x 1x           1x   1x   1x 1x                 2047x               6110x      
import { injectable, inject } from 'inversify';
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
import { IOptions } from '../../../interfaces/options/IOptions';
import { IStorage } from '../../../interfaces/storages/IStorage';
 
import { JSFuck } from '../../../enums/JSFuck';
 
import { AbstractReplacer } from './AbstractReplacer';
 
@injectable()
export class BooleanLiteralReplacer extends AbstractReplacer {
    /**
     * @param customNodesStorage
     * @param options
     */
    constructor (
        @inject(ServiceIdentifiers['IStorage<ICustomNode>']) customNodesStorage: IStorage<ICustomNode>,
        @inject(ServiceIdentifiers.IOptions) options: IOptions
    ) {
        super(customNodesStorage, options);
    }
 
    /**
     * @param nodeValue
     * @returns {string}
     */
    public replace (nodeValue: boolean): string {
        return nodeValue ? JSFuck.True : JSFuck.False;
    }
}