✨ convertBigIntToString

This commit is contained in:
Flam3rboy committed 2021-02-06 09:20:07 +01:00
1 parent 047066aca9
commit 6ab626fc0d
8 files changed
+36 -3

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@ import { JWTOptions } from "./Constants";
import jwt from "jsonwebtoken";
import Config from "./Config";
export function checkToken(token: string) {
export function checkToken(token: string): Promise<any> {
return new Promise((res, rej) => {
jwt.verify(token, Config.getAll().api.security.jwtSecret, JWTOptions, (err, decoded: any) => {
if (err || !decoded) return rej("Invalid Token");
+13
View File
@@ -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;
}