Skip to content

Commit 4bc7669

Browse files
committed
replace for of with forEach
1 parent 1db241c commit 4bc7669

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/util/Components.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -256,27 +256,26 @@ function getWrapperFunctions(context, pragma) {
256256
function mergeRules(rules) {
257257
/** @type {Map<string, Function[]>} */
258258
const handlersByKey = new Map();
259-
for (const rule of rules) {
260-
for (const key of Object.keys(rule)) {
259+
rules.forEach((rule) => {
260+
Object.keys(rule).forEach((key) => {
261261
const fns = handlersByKey.get(key);
262262
if (!fns) {
263263
handlersByKey.set(key, [rule[key]]);
264264
} else {
265265
fns.push(rule[key]);
266266
}
267-
}
268-
}
267+
});
268+
});
269269

270270
/** @type {{[key: string]: Function}} */
271271
const rule = {};
272-
for (const key of handlersByKey.keys()) {
273-
const fns = handlersByKey.get(key);
272+
handlersByKey.forEach((fns, key) => {
274273
rule[key] = function mergedHandler(node) {
275-
for (const fn of fns) {
274+
fns.forEach((fn) => {
276275
fn(node);
277-
}
276+
});
278277
};
279-
}
278+
});
280279

281280
return rule;
282281
}

0 commit comments

Comments
 (0)