Add new config use_path_based_img_url

Fix parseBitInt
This commit is contained in:
2024-06-02 13:33:46 +08:00
parent 329a91e9c0
commit 0ea6da38e4
8 changed files with 119 additions and 6 deletions

View File

@@ -300,7 +300,10 @@ export function toJSON(obj: unknown) {
export function parseBigInt(str: string) {
const t = parseInt(str);
if (isNaN(t)) return t;
return !Number.isSafeInteger(t) ? BigInt(str) : t;
if (Number.isSafeInteger(t)) return t;
const m = str.match(/^(\+|-)?\d+/);
if (!m) return NaN;
return BigInt(m[0]);
}
export function isNumNaN(num: number | bigint) {