dev.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. (function(){
  8. function foo () {
  9. function inner1 () {}
  10. inner1();
  11. }
  12. function bar () {
  13. function inner2 () {}
  14. inner2();
  15. }
  16. function baz () {
  17. function inner3 () {}
  18. inner3();
  19. }
  20. function bark () {
  21. function inner4 () {}
  22. inner4();
  23. }
  24. function hawk () {
  25. function inner5 () {}
  26. inner5();
  27. }
  28. })();
  29. `,
  30. {
  31. ...NO_ADDITIONAL_NODES_PRESET,
  32. compact: false,
  33. stringArray: true,
  34. stringArrayThreshold: 1,
  35. deadCodeInjection: true,
  36. deadCodeInjectionThreshold: 1
  37. }
  38. ).getObfuscatedCode();
  39. console.log(obfuscatedCode);
  40. console.log(eval(obfuscatedCode));
  41. })();