dev.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNodes';
  3. import { StringArrayEncoding } from '../../src/enums/StringArrayEncoding';
  4. (function () {
  5. const JavaScriptObfuscator: any = require('../../index');
  6. let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
  7. `
  8. const foo = 'foo';
  9. const bar = 'bar';
  10. function test () {
  11. const baz = 'baz';
  12. const bark = 'bark';
  13. function test1() {
  14. const hawk = 'hawk';
  15. const eagle = 'eagle';
  16. }
  17. }
  18. `,
  19. {
  20. ...NO_ADDITIONAL_NODES_PRESET,
  21. compact: false,
  22. stringArray: true,
  23. stringArrayThreshold: 1,
  24. stringArrayWrappersChainedCalls: true,
  25. stringArrayWrappersCount: 5,
  26. stringArrayEncoding: [
  27. StringArrayEncoding.None
  28. ]
  29. }
  30. ).getObfuscatedCode();
  31. console.log(obfuscatedCode);
  32. console.log(eval(obfuscatedCode));
  33. })();