dev.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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. const hawk = 'hawk';
  14. }
  15. const eagle = 'eagle';
  16. `,
  17. {
  18. ...NO_ADDITIONAL_NODES_PRESET,
  19. compact: false,
  20. stringArray: true,
  21. stringArrayThreshold: 1,
  22. stringArrayIntermediateVariablesCount: 5,
  23. stringArrayEncoding: [
  24. StringArrayEncoding.None
  25. ]
  26. }
  27. ).getObfuscatedCode();
  28. console.log(obfuscatedCode);
  29. console.log(eval(obfuscatedCode));
  30. })();