From 33f3391a8f62fd2897cf25d6acb36bd06cc91c11 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 20 Jan 2022 06:27:20 -0800 Subject: [PATCH] policy: check for null instead of falsy 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/policy/sri.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/policy/sri.js b/lib/internal/policy/sri.js index 6728ff4de22..22704704a31 100644 --- a/lib/internal/policy/sri.js +++ b/lib/internal/policy/sri.js @@ -38,7 +38,7 @@ const parse = (str) => { let prevIndex = 0; let match; const entries = []; - while (match = RegExpPrototypeExec(kSRIPattern, str)) { + while ((match = RegExpPrototypeExec(kSRIPattern, str)) !== null) { if (match.index !== prevIndex) { throw new ERR_SRI_PARSE(str, str[prevIndex], prevIndex); }