portfolio2023/src/util/parseSetCookie.ts
Andreas Schaafsma f6eef1ded3 Many Changes
2024-05-14 12:49:50 +02:00

11 lines
286 B
TypeScript

export function parseSetCookie(h: string[]) {
const penisregex = /(.*?)=(.*?)($|;|,(?! ))/gm;
let aaa = h.map(
s => [...s.matchAll(penisregex)]
);
const dict = Object.assign({}, ...aaa[0].map((e) => {
return { [e[1]]: decodeURIComponent(e[2]) };
}));
return dict;
}