From 393552805e37d554aa2ca5c7e693757a1a078381 Mon Sep 17 00:00:00 2001 From: Noritaka Kobayashi Date: Tue, 3 Jun 2025 23:09:53 +0900 Subject: [PATCH] refactor: replace "for" loop with "while" loop --- lib/helpers/splitIntoLines.js | 2 +- lib/helpers/splitIntoPotentialTokens.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helpers/splitIntoLines.js b/lib/helpers/splitIntoLines.js index e610c15..b2a4f58 100644 --- a/lib/helpers/splitIntoLines.js +++ b/lib/helpers/splitIntoLines.js @@ -13,7 +13,7 @@ const splitIntoLines = (str) => { const results = []; const len = str.length; let i = 0; - for (; i < len; ) { + while (i < len) { const cc = str.charCodeAt(i); // 10 is "\n".charCodeAt(0) if (cc === 10) { diff --git a/lib/helpers/splitIntoPotentialTokens.js b/lib/helpers/splitIntoPotentialTokens.js index 92ee4a9..f178fbc 100644 --- a/lib/helpers/splitIntoPotentialTokens.js +++ b/lib/helpers/splitIntoPotentialTokens.js @@ -22,7 +22,7 @@ const splitIntoPotentialTokens = (str) => { if (len === 0) return null; const results = []; let i = 0; - for (; i < len; ) { + while (i < len) { const s = i; block: { let cc = str.charCodeAt(i);