From 1a478bb596a8da89e6434907dda4bc8650e50eec Mon Sep 17 00:00:00 2001 From: Jack Kavanagh Date: Fri, 3 Sep 2021 11:11:23 +0200 Subject: [PATCH] fix(bigint) throw large numbers --- src/parse.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parse.ts b/src/parse.ts index 544a7f8..35570e5 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -8,6 +8,10 @@ const traverseObject = ( parentKey: string, separator: string ) => { + if(typeof value === 'number' && obj > Number.MAX_SAFE_INTEGER) { + throw new Error('Do not know how to serialize a BigInt') + } + const childKeys = Object.keys(obj); if (childKeys.length === 0) {