From d8171de4ba82614c97c8e5a2376786cff9680671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=C2=A0S=2E=20Choi?= Date: Sun, 21 Nov 2021 19:03:32 -0700 Subject: [PATCH] =?UTF-8?q?parser=20plugin-utils:=20Remove=20Object.entrie?= =?UTF-8?q?s=20call=20for=20Node=C2=A06?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/babel-parser/src/plugin-utils.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/babel-parser/src/plugin-utils.js b/packages/babel-parser/src/plugin-utils.js index e829e2b01bee..cb750f16e0ab 100644 --- a/packages/babel-parser/src/plugin-utils.js +++ b/packages/babel-parser/src/plugin-utils.js @@ -24,8 +24,9 @@ export function hasPlugin( const [expectedName, expectedOptions] = typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig; - const expectedOptionsIsEmpty = - [...Object.entries(expectedOptions)].length === 0; + const expectedKeys = Object.keys(expectedOptions); + + const expectedOptionsIsEmpty = expectedKeys.length === 0; return plugins.some(p => { if (typeof p === "string") { @@ -35,8 +36,8 @@ export function hasPlugin( if (pluginName !== expectedName) { return false; } - for (const [key, expectedValue] of Object.entries(expectedOptions)) { - if (expectedValue !== pluginOptions[key]) { + for (const key of expectedKeys) { + if (pluginOptions[key] !== expectedOptions[key]) { return false; } }