12 lines · 469 B · TypeScript
RawDownload
// The one request-header cookie parser (workos.ts, edge/marketing.ts, and the// SSR auth gate all need it). Pure string code — safe in any bundle. export const parseCookie = (cookieHeader: string | null, name: string): string | null => {  if (!cookieHeader) return null;  const match = cookieHeader    .split(";")    .map((c) => c.trim())    .find((c) => c.startsWith(`${name}=`));  if (!match) return null;  return match.slice(name.length + 1) || null;};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t