Files
eh-downloader/server/cookies.ts
2023-07-03 11:51:13 +08:00

13 lines
324 B
TypeScript

export function parse_cookies(c: string | null) {
const m = new Map<string, string>();
if (c === null) return m;
for (const a of c.split(";")) {
const b = a.trim();
const d = b.split("=");
if (d.length > 1) {
m.set(d[0], d.slice(1).join("="));
}
}
return m;
}