From a4ad26d4dc1305ddccd909230e4c4c94d0c1ec4d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jan 2022 06:36:33 -0800 Subject: [PATCH] util: check for null instead of flasy in loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Anna Henningsen --- lib/internal/util/inspect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 814e5bf0f37cd4..ca3227dea43c99 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -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');