From beac2e6eb1032d6c1f9b4f20e070bdb5c878022b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 7 Sep 2016 18:00:12 -0400 Subject: [PATCH] fix regex --- src/ast/nodes/VariableDeclaration.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ast/nodes/VariableDeclaration.js b/src/ast/nodes/VariableDeclaration.js index 767aab2..e1be1a0 100644 --- a/src/ast/nodes/VariableDeclaration.js +++ b/src/ast/nodes/VariableDeclaration.js @@ -14,6 +14,8 @@ function getSeparator ( code, start ) { return `;\n${lineStart}`; } +const forStatement = /^For(?:Of|In)Statement/; + export default class VariableDeclaration extends Node { initialise ( scope ) { this.scope = scope; @@ -26,7 +28,7 @@ export default class VariableDeclaration extends Node { let shouldSeparate = false; let separator; - if ( this.scope.isModuleScope && !/forStatement/.test( this.parent.type ) ) { + if ( this.scope.isModuleScope && !forStatement.test( this.parent.type ) ) { shouldSeparate = true; separator = getSeparator( this.module.code, this.start ); }