From f3adc11e37b8bfaaa026ea85c1cf22e3a0e29ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=A9=EC=A7=84=ED=98=81?= Date: Fri, 8 Aug 2025 07:47:09 +0900 Subject: [PATCH] assert: change utils to use index instead of for...of PR-URL: https://github.com/nodejs/node/pull/59278 Refs: https://github.com/nodejs/node/blob/main/doc/contributing/primordials.md#unsafe-array-iteration Reviewed-By: Jordan Harband Reviewed-By: Zeyu "Alex" Yang Reviewed-By: Daeyeon Jeong --- lib/internal/assert/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/assert/utils.js b/lib/internal/assert/utils.js index d059fa89baf..13e41d67c63 100644 --- a/lib/internal/assert/utils.js +++ b/lib/internal/assert/utils.js @@ -222,7 +222,8 @@ function getErrMessage(message, fn) { } const frames = StringPrototypeSplit(message, '\n'); message = ArrayPrototypeShift(frames); - for (const frame of frames) { + for (let i = 0; i < frames.length; i++) { + const frame = frames[i]; let pos = 0; while (pos < column && (frame[pos] === ' ' || frame[pos] === '\t')) { pos++;