summary refs log tree commit diff
path: root/src/util/convertBigIntToString.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/convertBigIntToString.ts')
-rw-r--r--src/util/convertBigIntToString.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/convertBigIntToString.ts b/src/util/convertBigIntToString.ts
new file mode 100644
index 00000000..2c8d9a38
--- /dev/null
+++ b/src/util/convertBigIntToString.ts
@@ -0,0 +1,13 @@
+import "missing-native-js-functions";
+
+export function convertBigIntToString(obj: any) {
+	if (typeof obj === "bigint") obj = obj.toString();
+
+	if (typeof obj === "object") {
+		obj.keys().forEach((key: string) => {
+			obj[key] = convertBigIntToString(obj[key]);
+		});
+	}
+
+	return obj;
+}