Skip to content

Commit b79aeab

Browse files
MCproteintargos
authored andcommitted
lib: avoid for of loop and remove unnecessary variable in zlib
removed the unnecessary declaration of 'i' in the _final method scope and changed the for of loop to a for loop Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration PR-URL: #54258 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 7e25fab commit b79aeab

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/zlib.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,10 @@ ZlibBase.prototype._final = function(callback) {
361361
// Z_NO_FLUSH (< Z_TREES) < Z_BLOCK < Z_PARTIAL_FLUSH <
362362
// Z_SYNC_FLUSH < Z_FULL_FLUSH < Z_FINISH
363363
const flushiness = [];
364-
let i = 0;
365364
const kFlushFlagList = [Z_NO_FLUSH, Z_BLOCK, Z_PARTIAL_FLUSH,
366365
Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH];
367-
for (const flushFlag of kFlushFlagList) {
368-
flushiness[flushFlag] = i++;
366+
for (let i = 0; i < kFlushFlagList.length; i++) {
367+
flushiness[kFlushFlagList[i]] = i;
369368
}
370369

371370
function maxFlush(a, b) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy