dev.ts 967 B

123456789101112131415161718192021222324252627
  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. var test = '\\nreturn \\n//# sourceURL= there can only be \\'^\\' and \\'!\\' markers in a subscription marble diagram.';
  9. console.log(test);
  10. `,
  11. {
  12. ...NO_ADDITIONAL_NODES_PRESET,
  13. compact: false,
  14. identifierNamesGenerator: IdentifierNamesGenerator.MangledIdentifierNamesGenerator,
  15. stringArray: true,
  16. stringArrayThreshold: 1,
  17. unicodeEscapeSequence: false
  18. }
  19. ).getObfuscatedCode();
  20. console.log(obfuscatedCode);
  21. console.log(eval(obfuscatedCode));
  22. })();