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 <ljharb@gmail.com>
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
This commit is contained in:
방진혁 2025-08-08 07:47:09 +09:00 committed by GitHub
parent bfffd44457
commit f3adc11e37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -222,7 +222,8 @@ function getErrMessage(message, fn) {
} }
const frames = StringPrototypeSplit(message, '\n'); const frames = StringPrototypeSplit(message, '\n');
message = ArrayPrototypeShift(frames); message = ArrayPrototypeShift(frames);
for (const frame of frames) { for (let i = 0; i < frames.length; i++) {
const frame = frames[i];
let pos = 0; let pos = 0;
while (pos < column && (frame[pos] === ' ' || frame[pos] === '\t')) { while (pos < column && (frame[pos] === ' ' || frame[pos] === '\t')) {
pos++; pos++;