Files
javascript-obfuscator-javas…/test/dev/dev.ts
T
sanex3339 945e885240 * Fixed identifier names generations for mangled and dictionary identifier names generators
* Fixed combination of `identifierNamesGenerator: dictionary` and `debugProtection` options
* `seed` option now accepts `string` and `number` values
2020-01-01 21:46:51 +03:00

55 lines
1.9 KiB
TypeScript

'use strict';
import { IdentifierNamesGenerator } from '../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
(function () {
const JavaScriptObfuscator: any = require('../../index');
let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
`
// Paste your JavaScript code here
function hi() {
console.log("Hello World!");
}
hi();
`,
{
compact: false,
selfDefending: false,
disableConsoleOutput: false,
debugProtection: false,
debugProtectionInterval: false,
splitStrings: true,
splitStringsChunkLength: 5,
splitStringsChunkLengthEnabled: true,
stringArray: true,
rotateStringArray: false,
rotateStringArrayEnabled: true,
stringArrayThreshold: 1,
stringArrayThresholdEnabled: true,
stringArrayEncoding: false,
stringArrayEncodingEnabled: true,
sourceMap: false,
sourceMapBaseUrl: "",
sourceMapFileName: "",
sourceMapSeparate: false,
domainLock: [],
reservedNames: [],
reservedStrings: [],
seed: 0,
controlFlowFlatteningThreshold: 1,
controlFlowFlattening: true,
deadCodeInjectionThreshold: 1,
deadCodeInjection: true,
unicodeEscapeSequence: false,
renameGlobals: true,
identifierNamesGenerator: IdentifierNamesGenerator.DictionaryIdentifierNamesGenerator,
identifiersDictionary: ["foo", "bar", "baz", "bark", "hawk", "fooz", "moscow", "chikago"],
identifiersPrefix: "",
transformObjectKeys: true
}
).getObfuscatedCode();
console.log(obfuscatedCode);
console.log(eval(obfuscatedCode));
})();