dev.ts 973 B

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