From 4654460e22964eb909461d4144baaa8ac6829f37 Mon Sep 17 00:00:00 2001 From: dunak-debug <19434539+dunak-debug@users.noreply.github.com> Date: Fri, 17 Sep 2021 20:01:47 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Don=C2=B4t=20throw=20error=20if=20parame?= =?UTF-8?q?ter=20is=20zero=20or=20false,=20check=20for=20undefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- patches/named-placeholders+1.1.2.patch | 4 ++-- src/parser.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/named-placeholders+1.1.2.patch b/patches/named-placeholders+1.1.2.patch index 13c1b6b..6bfe320 100644 --- a/patches/named-placeholders+1.1.2.patch +++ b/patches/named-placeholders+1.1.2.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/named-placeholders/index.js b/node_modules/named-placeholders/index.js -index 527d723..84ee8f3 100644 +index 527d723..f47b591 100644 --- a/node_modules/named-placeholders/index.js +++ b/node_modules/named-placeholders/index.js @@ -3,7 +3,7 @@ @@ -24,7 +24,7 @@ index 527d723..84ee8f3 100644 + const tokens = tree[1]; for (let i=0; i < tokens.length; ++i) { -+ if(!params[tokens[i]]) throw new Error(`Undefined parameter ${tokens[i]}`); ++ if(params[tokens[i]] === undefined) throw new Error(`Undefined parameter ${tokens[i]}`); arr.push(params[tokens[i]]); } + diff --git a/src/parser.js b/src/parser.js index 5b62289..487df0a 100644 --- a/src/parser.js +++ b/src/parser.js @@ -42,7 +42,7 @@ const parseParameters = (query, parameters) => { throw new Error(`Undefined parameter #${parameters.length}`, query, parameters); } else { queryParams.forEach((_, i) => { - if (!parameters[`${i + 1}`]) throw new FormatError(`Undefined parameter #${i + 1}`, query, parameters); + if (parameters[`${i + 1}`] === undefined) throw new FormatError(`Undefined parameter #${i + 1}`, query, parameters); }); }