Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdccwxx <765553928@qq.com>2021-10-07 15:42:57 +0300
committerNode.js GitHub Bot <github-bot@iojs.org>2021-10-09 20:22:56 +0300
commitac4f5e2437c70a64cef141b15f20765fa75550a0 (patch)
tree4332370c018624eefc88018bb51b06bc86e3b3c2
parenteafdeab97b6757485781f19b90786a87b2b36369 (diff)
lib: refactor to use let
move variable into each for loop PR-URL: https://github.com/nodejs/node/pull/40364 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
-rw-r--r--lib/internal/debugger/inspect_client.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/internal/debugger/inspect_client.js b/lib/internal/debugger/inspect_client.js
index 5c72304ba28..5bd73d250c2 100644
--- a/lib/internal/debugger/inspect_client.js
+++ b/lib/internal/debugger/inspect_client.js
@@ -61,8 +61,6 @@ function validateHandshake(requestKey, responseKey) {
}
function encodeFrameHybi17(payload) {
- var i;
-
const dataLength = payload.length;
let singleByteLength;
@@ -71,7 +69,7 @@ function encodeFrameHybi17(payload) {
singleByteLength = kEightBytePayloadLengthField;
additionalLength = Buffer.alloc(8);
let remaining = dataLength;
- for (i = 0; i < 8; ++i) {
+ for (let i = 0; i < 8; ++i) {
additionalLength[7 - i] = remaining & 0xFF;
remaining >>= 8;
}
@@ -92,7 +90,7 @@ function encodeFrameHybi17(payload) {
const mask = Buffer.alloc(4);
const masked = Buffer.alloc(dataLength);
- for (i = 0; i < dataLength; ++i) {
+ for (let i = 0; i < dataLength; ++i) {
masked[i] = payload[i] ^ mask[i % kMaskingKeyWidthInBytes];
}
@@ -147,7 +145,7 @@ function decodeFrameHybi17(data) {
case kEightBytePayloadLengthField:
payloadOffset += 8;
payloadLength = 0;
- for (var i = 0; i < 8; ++i) {
+ for (let i = 0; i < 8; ++i) {
payloadLength <<= 8;
payloadLength |= data[2 + i];
}