11 lines
286 B
TypeScript
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;
|
|
}
|