mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add max_length settings to export zip
This commit is contained in:
@@ -12,3 +12,14 @@ export async function parse_bool<T extends boolean | null>(
|
||||
return n !== 0;
|
||||
}
|
||||
}
|
||||
|
||||
export async function parse_int<T extends number | null>(
|
||||
value: FormDataEntryValue | null,
|
||||
def: T,
|
||||
): Promise<number | T> {
|
||||
if (value === null) return def;
|
||||
const v = typeof value === "string" ? value : await value.text();
|
||||
const n = parseInt(v);
|
||||
if (isNaN(n)) return def;
|
||||
return n;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user