From f1ff1070b81bb7eaf7a2fffce3044bde976612c9 Mon Sep 17 00:00:00 2001 From: Mihail Bodrov Date: Sat, 10 Feb 2018 19:38:45 +0300 Subject: [PATCH] url: simplify constructor URLSearchParams. Remove needless check null PR-URL: https://github.com/nodejs/node/pull/18700 Reviewed-By: Ruben Bridgewater Reviewed-By: Gus Caplan Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- lib/internal/url.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index b395e77b046f10..cae4037b6e7792 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -98,8 +98,7 @@ class URLSearchParams { constructor(init = undefined) { if (init === null || init === undefined) { this[searchParams] = []; - } else if ((typeof init === 'object' && init !== null) || - typeof init === 'function') { + } else if (typeof init === 'object' || typeof init === 'function') { const method = init[Symbol.iterator]; if (method === this[Symbol.iterator]) { // While the spec does not have this branch, we can use it as a