dev.ts 734 B

1234567891011121314151617181920212223242526
  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 ab = 'abc';
  8. `,
  9. {
  10. ...NO_ADDITIONAL_NODES_PRESET,
  11. compact: false,
  12. identifierNamesGenerator: 'dictionary',
  13. identifiersDictionary: ['a', 'b'],
  14. identifiersPrefix: 'a',
  15. transformObjectKeys: true,
  16. stringArray: true,
  17. stringArrayThreshold: 1
  18. }
  19. ).getObfuscatedCode();
  20. console.log(obfuscatedCode);
  21. console.log(eval(obfuscatedCode));
  22. })();