UNPKG

typia

Version:

Superfast runtime validators with only one line

19 lines (17 loc) 386 B
export const _httpFormDataReadBigint = ( input: string | File | null, ): bigint | null | undefined => input instanceof File ? (input as any) : !!input?.length ? input === "null" ? null : (toBigint(input) as any) : undefined; const toBigint = (str: string): bigint | string => { try { return BigInt(str); } catch { return str; } };