Skip to content

Commit

Permalink
parser plugin-utils: Remove Object.entries call for Node聽6
Browse files Browse the repository at this point in the history
  • Loading branch information
js-choi committed Nov 22, 2021
1 parent e7c71dc commit d8171de
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/babel-parser/src/plugin-utils.js
Expand Up @@ -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") {
Expand All @@ -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;
}
}
Expand Down

0 comments on commit d8171de

Please sign in to comment.