From 5425d8354b0421d5fe4458cf7c7bb67ef8b2c650 Mon Sep 17 00:00:00 2001 From: kachalov Date: Thu, 12 May 2016 10:50:16 +0300 Subject: [PATCH] dev --- index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 43744b51..dc32fc67 100644 --- a/index.ts +++ b/index.ts @@ -28,14 +28,21 @@ export class JavaScriptObfuscator { obfuscator.obfuscateNode(astTree); - return JavaScriptObfuscator.generateCode(astTree); + return JavaScriptObfuscator.generateCode(astTree, options); } /** * @param astTree + * @param options */ - private static generateCode (astTree: any): string { - return escodegen.generate(astTree, JavaScriptObfuscator.escodegenParams); + private static generateCode (astTree: any, options: any): string { + let escodegenParams: any = Object.assign({}, JavaScriptObfuscator.escodegenParams); + + if (options.compact !== undefined) { + escodegenParams.format.compact = options.compact; + } + + return escodegen.generate(astTree, escodegenParams); } }