From e55800d40a16c7f87aa8f999b0987d3a3f24ea30 Mon Sep 17 00:00:00 2001 From: SaiHemanth-uab Date: Fri, 22 Sep 2023 14:17:58 -0500 Subject: [PATCH] improvement:Replace forEach() and push() wth filter() in test-webcrypto-keygen.js --- test/parallel/test-webcrypto-keygen.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/parallel/test-webcrypto-keygen.js b/test/parallel/test-webcrypto-keygen.js index dceb3348528911..fbdaee0f2e79a8 100644 --- a/test/parallel/test-webcrypto-keygen.js +++ b/test/parallel/test-webcrypto-keygen.js @@ -227,11 +227,7 @@ const vectors = { { message: /Usages cannot be empty/ }); } - const invalidUsages = []; - allUsages.forEach((usage) => { - if (!vectors[name].usages.includes(usage)) - invalidUsages.push(usage); - }); + const invalidUsages = allUsages.filter(usage => !vectors[name].usages.includes(usage)); for (const invalidUsage of invalidUsages) { await assert.rejects( subtle.generateKey(