How to use the javascript-obfuscator.JavaScriptObfuscator.obfuscate function in javascript-obfuscator

To help you get started, we’ve selected a few javascript-obfuscator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / javascript-obfuscator / javascript-obfuscator-tests.ts View on Github external

import { JavaScriptObfuscator } from 'javascript-obfuscator';

let sourceCode1: string = JavaScriptObfuscator.obfuscate('var foo = 1;');
let sourceCode2: string = JavaScriptObfuscator.obfuscate('var foo = 1;', {
  compact: true,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: true,
    encodeUnicodeLiterals: false,
    reservedNames: ['^foo$'],
    rotateUnicodeArray: true,
    selfDefending: true,
    unicodeArray: true,
    unicodeArrayThreshold: 0.8,
    wrapUnicodeArrayCalls: true


JavaScript obfuscator

Latest version published 9 months ago

Package Health Score

77 / 100
Full package analysis