mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
7e25fabb91
commit
b79aeabc4d
1 file changed
+2
-3
+2
-3
@@ -361,11 +361,10 @@ ZlibBase.prototype._final = function(callback) {
|
||||
// Z_NO_FLUSH (< Z_TREES) < Z_BLOCK < Z_PARTIAL_FLUSH <
|
||||
// Z_SYNC_FLUSH < Z_FULL_FLUSH < Z_FINISH
|
||||
const flushiness = [];
|
||||
let i = 0;
|
||||
const kFlushFlagList = [Z_NO_FLUSH, Z_BLOCK, Z_PARTIAL_FLUSH,
|
||||
Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH];
|
||||
for (const flushFlag of kFlushFlagList) {
|
||||
flushiness[flushFlag] = i++;
|
||||
for (let i = 0; i < kFlushFlagList.length; i++) {
|
||||
flushiness[kFlushFlagList[i]] = i;
|
||||
}
|
||||
|
||||
function maxFlush(a, b) {
|
||||
|
||||
Reference in new issue
Block a user