util: check for null instead of flasy in loop

This prepares the code for the no-cond-assign ESLint rule.

PR-URL: https://github.com/nodejs/node/pull/41614
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Rich Trott authored and Beth Griggs committed 2022-01-24 17:36:00 +00:00
1 parent 2b4e46f07d
commit 0e35d01a4a
1 file changed
+1 -1
+1 -1
View File
@@ -1311,7 +1311,7 @@ function formatError(err, constructor, tag, ctx, keys) {
let nodeModule;
newStack += '\n';
let pos = 0;
while (nodeModule = nodeModulesRegExp.exec(line)) {
while ((nodeModule = nodeModulesRegExp.exec(line)) !== null) {
// '/node_modules/'.length === 14
newStack += line.slice(pos, nodeModule.index + 14);
newStack += ctx.stylize(nodeModule[1], 'module');