Files
javascript-obfuscator-javas…/test/dev/test.ts
T
sanex3339 a70f192a1c Merge branch 'domain-lock' of https://github.com/slig/javascript-obfuscator into slig-domain-lock
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

DomainLock feature WIP
2016-09-01 18:36:03 +03:00

74 lines
1.6 KiB
TypeScript

'use strict';
if (!(<any>global)._babelPolyfill) {
require('babel-polyfill');
}
const JavaScriptObfuscator: any = require("../../index");
let obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
`
(function(){
var result = 1,
term1 = 0,
term2 = 1,
i = 1;
while(i < 10)
{
var test = 10;
result = term1 + term2;
console.log(result);
term1 = term2;
term2 = result;
i++;
}
console.log(test);
var test = function (test) {
console.log(test);
if (true) {
var test = 5
}
return test;
}
console.log(test(1));
function test2 (abc) {
function test1 () {
console.log('inside', abc.item);
}
console.log('тест', abc);
var abc = {};
return abc.item = 15, test1();
};
var regexptest = /version\\/(\\d+)/i;
console.log(regexptest);
test2(22);
console.log(105.4);
console.log(true, false);
try {
} catch (error) {
console.log(error);
}
})();
`,
{
disableConsoleOutput: false,
domainLock: ['.google.ru'],
encodeUnicodeLiterals: true
}
).getObfuscatedCode();
console.log(obfuscatedCode);
console.log(eval(obfuscatedCode));