diff options
author | raisinten <raisinten@gmail.com> | 2020-12-13 18:57:01 +0530 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2020-12-21 15:03:58 +0100 |
commit | 1eb228eafd55ac20b70982866bc8f1cd5f31d6fb (patch) | |
tree | 541d274e3a5cc094681013c1d9af40327485a0c7 /lib/querystring.js | |
parent | 54e763ddc9f85a1198718da2db8106dba5209909 (diff) | |
download | node-new-1eb228eafd55ac20b70982866bc8f1cd5f31d6fb.tar.gz |
lib: support BigInt in querystring.stringify
Fixes: https://github.com/nodejs/node/issues/36080
PR-URL: https://github.com/nodejs/node/pull/36499
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'lib/querystring.js')
-rw-r--r-- | lib/querystring.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/querystring.js b/lib/querystring.js index 644cee4bde..658c9c052f 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -162,6 +162,8 @@ function stringifyPrimitive(v) { return v; if (typeof v === 'number' && NumberIsFinite(v)) return '' + v; + if (typeof v === 'bigint') + return '' + v; if (typeof v === 'boolean') return v ? 'true' : 'false'; return ''; @@ -176,6 +178,8 @@ function encodeStringified(v, encode) { // escaping due to the inclusion of a '+' in the output return (MathAbs(v) < 1e21 ? '' + v : encode('' + v)); } + if (typeof v === 'bigint') + return '' + v; if (typeof v === 'boolean') return v ? 'true' : 'false'; return ''; |