dev.ts 826 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. import { NO_CUSTOM_NODES_PRESET } from '../../src/preset-options/NoCustomNodesPreset';
  3. if (!(<any>global)._babelPolyfill) {
  4. require('babel-polyfill');
  5. }
  6. (function () {
  7. const JavaScriptObfuscator: any = require("../../index");
  8. let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
  9. `
  10. (function(){
  11. function t () {
  12. return function () {
  13. var t = 1 * 2;
  14. }
  15. }
  16. var s = 1 - 3;
  17. })();
  18. `,
  19. {
  20. ...NO_CUSTOM_NODES_PRESET,
  21. controlFlowFlattening: true,
  22. disableConsoleOutput: false
  23. }
  24. ).getObfuscatedCode();
  25. console.log(obfuscatedCode);
  26. console.log(eval(obfuscatedCode));
  27. })();