From e50a701df7a295deb33be2f5d92e3e8e269ea966 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Fri, 20 May 2016 22:58:03 +0300 Subject: [PATCH] refactoring --- index.js | 1 - index.ts | 2 -- src/Utils.ts | 2 +- tests/dev-test.js | 5 +++-- tests/dev-test.ts | 6 +++--- tslint.json | 4 ++-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 644c48d5..748749b8 100644 --- a/index.js +++ b/index.js @@ -25,4 +25,3 @@ JavaScriptObfuscator.escodegenParams = { verbatim: 'x-verbatim-property' }; exports.JavaScriptObfuscator = JavaScriptObfuscator; -module.exports = JavaScriptObfuscator; diff --git a/index.ts b/index.ts index 6e9a3511..42aa8539 100644 --- a/index.ts +++ b/index.ts @@ -52,5 +52,3 @@ export class JavaScriptObfuscator { return escodegen.generate(astTree, escodegenParams); } } - -module.exports = JavaScriptObfuscator; diff --git a/src/Utils.ts b/src/Utils.ts index 38bf6af8..4d61c7af 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -4,7 +4,7 @@ export class Utils { * @param searchElement * @returns {boolean} */ - public static arrayContains (array: any[], searchElement: any) { + public static arrayContains (array: any[], searchElement: any): boolean { return array.indexOf(searchElement) >= 0; } diff --git a/tests/dev-test.js b/tests/dev-test.js index b5b1f08a..259f2433 100644 --- a/tests/dev-test.js +++ b/tests/dev-test.js @@ -1,5 +1,6 @@ -var JavaScriptObfuscator = require('../index.js'); -var obfuscatedCode = JavaScriptObfuscator.obfuscate(` +"use strict"; +const index_1 = require("../index"); +let obfuscatedCode = index_1.JavaScriptObfuscator.obfuscate(` (function(){ var result = 1, term1 = 0, diff --git a/tests/dev-test.ts b/tests/dev-test.ts index 46bf68dc..6c1cc2e5 100644 --- a/tests/dev-test.ts +++ b/tests/dev-test.ts @@ -1,6 +1,6 @@ -var JavaScriptObfuscator = require('../index.js'); +import { JavaScriptObfuscator } from "../index"; -var obfuscatedCode = JavaScriptObfuscator.obfuscate( +let obfuscatedCode: string = JavaScriptObfuscator.obfuscate( ` (function(){ var result = 1, @@ -52,4 +52,4 @@ var obfuscatedCode = JavaScriptObfuscator.obfuscate( ); console.log(obfuscatedCode); -console.log(eval(obfuscatedCode)); \ No newline at end of file +console.log(eval(obfuscatedCode)); diff --git a/tslint.json b/tslint.json index d313255e..76bb6893 100644 --- a/tslint.json +++ b/tslint.json @@ -64,7 +64,7 @@ "no-duplicate-key": true, "no-duplicate-variable": true, "no-empty": false, - "no-eval": true, + "no-eval": false, "no-inferrable-types": false, "no-internal-module": true, "no-invalid-this": [ @@ -77,7 +77,7 @@ "no-shadowed-variable": false, "no-string-literal": false, "no-switch-case-fall-through": true, - "no-trailing-whitespace": false, + "no-trailing-whitespace": true, "no-unreachable": true, "no-unused-expression": true, "no-unused-variable": true,