Bläddra i källkod

replaced let on const in for-of loops

sanex3339 8 år sedan
förälder
incheckning
ba49e8edcd

+ 1 - 1
src/cli/JavaScriptObfuscatorCLI.ts

@@ -102,7 +102,7 @@ export class JavaScriptObfuscatorCLI {
         let obfuscatorOptions: IObfuscatorOptions = {},
             availableOptions: string[] = Object.keys(DEFAULT_PRESET);
 
-        for (let option in this.commands) {
+        for (const option in this.commands) {
             if (!this.commands.hasOwnProperty(option)) {
                 continue;
             }

+ 2 - 2
src/options/OptionsNormalizer.ts

@@ -53,7 +53,7 @@ export class OptionsNormalizer {
     public static normalizeOptions (options: IOptions): IOptions {
         let normalizedOptions: IOptions = Object.assign({}, options);
 
-        for (let normalizerRule of OptionsNormalizer.normalizerRules) {
+        for (const normalizerRule of OptionsNormalizer.normalizerRules) {
             normalizedOptions = normalizerRule(normalizedOptions);
         }
 
@@ -68,7 +68,7 @@ export class OptionsNormalizer {
         if (options.domainLock.length) {
             let normalizedDomains: string[] = [];
 
-            for (let domain of options.domainLock) {
+            for (const domain of options.domainLock) {
                 normalizedDomains.push(Utils.extractDomainFromUrl(domain));
             }
 

+ 2 - 2
src/options/ValidationErrorsFormatter.ts

@@ -8,7 +8,7 @@ export class ValidationErrorsFormatter {
     public static format (validationErrors: ValidationError[]): string {
         let errorsArray: string[] = [];
 
-        for (let error of validationErrors) {
+        for (const error of validationErrors) {
             errorsArray.push(ValidationErrorsFormatter.formatError(error));
         }
 
@@ -23,7 +23,7 @@ export class ValidationErrorsFormatter {
         let errorString: string = `\`${validationError.property}\` errors:\n`,
             constraints: {[type: string]: string} = validationError.constraints;
 
-        for (let constraint in constraints) {
+        for (const constraint in constraints) {
             if (!constraints.hasOwnProperty(constraint)) {
                 continue;
             }

+ 1 - 1
src/stack-trace-analyzer/StackTraceAnalyzer.ts

@@ -83,7 +83,7 @@ export class StackTraceAnalyzer implements IStackTraceAnalyzer {
     private analyzeRecursive (blockScopeBody: ESTree.Node[]): IStackTraceData[] {
         const stackTraceData: IStackTraceData[] = [];
 
-        for (let rootNode of blockScopeBody) {
+        for (const rootNode of blockScopeBody) {
             estraverse.traverse(rootNode, {
                 enter: (node: ESTree.Node): any => {
                     if (!Nodes.isCallExpressionNode(node) || rootNode.parentNode !== NodeUtils.getBlockScopeOfNode(node)) {

+ 1 - 1
src/stack-trace-analyzer/callee-data-extractors/ObjectExpressionCalleeDataExtractor.ts

@@ -134,7 +134,7 @@ export class ObjectExpressionCalleeDataExtractor implements ICalleeDataExtractor
             return null;
         }
 
-        for (let propertyNode of objectExpressionProperties) {
+        for (const propertyNode of objectExpressionProperties) {
             const isTargetPropertyNodeWithIdentifierKey: boolean =
                 Nodes.isIdentifierNode(propertyNode.key) && propertyNode.key.name === nextItemInCallsChain;
             const isTargetPropertyNodeWithLiteralKey: boolean =