dev.ts 947 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. import { NO_ADDITIONAL_NODES_PRESET } from '../../src/options/presets/NoCustomNodes';
  3. import { IdentifierNamesGenerator } from '../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
  4. (function () {
  5. const JavaScriptObfuscator: any = require('../../index');
  6. let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
  7. `
  8. [].map(v => 'vvv');
  9. `,
  10. {
  11. ...NO_ADDITIONAL_NODES_PRESET,
  12. compact: false,
  13. identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator,
  14. renameGlobals: true,
  15. stringArray: true,
  16. transformObjectKeys: true,
  17. stringArrayThreshold: 1,
  18. stringArrayWrappersChainedCalls: false,
  19. stringArrayWrappersCount: 1
  20. }
  21. ).getObfuscatedCode();
  22. console.log(obfuscatedCode);
  23. console.log(eval(obfuscatedCode));
  24. })();