From 14de68d8492a95ca6209b384ebce994687dfa8c3 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 24 Sep 2015 20:22:01 +0300 Subject: [PATCH] Don't use for-of. Should fix gaearon/react-transform-boilerplate#32 --- src/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index ab6e262..b09a796 100644 --- a/src/index.js +++ b/src/index.js @@ -46,12 +46,13 @@ export default function ({ Plugin, types: t }) { function buildIsCreateClassCallExpression(factoryMethods) { const matchMemberExpressions = {}; - for (const method of factoryMethods) { + factoryMethods.forEach(method => { matchMemberExpressions[method] = t.buildMatchMemberExpression(method); - } + }); return node => { - for (const method of factoryMethods) { + for (let i = 0; i < factoryMethods.length; i++) { + const method = factoryMethods[i]; if (method.indexOf('.') !== -1) { if (matchMemberExpressions[method](node.callee)) { return true;