From 0d53e5aab822b24991e5de66361144f25f08bcd8 Mon Sep 17 00:00:00 2001 From: Andrea Vanelli <50946384+avanelli@users.noreply.github.com> Date: Fri, 2 Sep 2022 17:04:04 +0200 Subject: [PATCH] fix: Convert logical nullish assignment for backward compatibility (#1625) * fix: remove logical nullish assignment * more readable code --- lib/fetch/headers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fetch/headers.js b/lib/fetch/headers.js index 69a3ec57576..78f2990774f 100644 --- a/lib/fetch/headers.js +++ b/lib/fetch/headers.js @@ -402,7 +402,9 @@ class Headers { } get [kHeadersSortedMap] () { - this[kHeadersList][kHeadersSortedMap] ??= new Map([...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1)) + if (!this[kHeadersList][kHeadersSortedMap]) { + this[kHeadersList][kHeadersSortedMap] = new Map([...this[kHeadersList]].sort((a, b) => a[0] < b[0] ? -1 : 1)) + } return this[kHeadersList][kHeadersSortedMap] }