From a7e546c420eeed5184bf52570911f6390aee9aec Mon Sep 17 00:00:00 2001 From: ewfian Date: Mon, 24 Apr 2023 21:33:23 +0900 Subject: [PATCH] fix: JSON.stringify cannot serialize BigInt. --- bin/pickletojson.js | 2 +- examples/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pickletojson.js b/bin/pickletojson.js index 07fbab9..7d81eb2 100755 --- a/bin/pickletojson.js +++ b/bin/pickletojson.js @@ -16,7 +16,7 @@ const replacer = (_, value) => { if (value instanceof Set) { return Array.from(value); } - if (value === 'bigint') { + if (typeof value === 'bigint') { return value.toString(); } return value; diff --git a/examples/index.html b/examples/index.html index e1c0d47..c78e6ee 100644 --- a/examples/index.html +++ b/examples/index.html @@ -43,7 +43,7 @@

Pickle Parser Demo

if (value instanceof Set) { return Array.from(value); } - if (value === 'bigint') { + if (typeof value === 'bigint') { return value.toString(); } return value;