summary refs log tree commit diff
path: root/src/util/convertBigIntToString.ts
blob: 2c8d9a383d8216a3558fc64a1c53f4be071f9bf4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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;
}