fn
getCookieValue
v0.0.5Looks up a single cookie in a document.cookie-style string
without building a full map — same first-occurrence and verbatim-raw-value
semantics as parseCookieString, but allocation-free for misses and
cheap for hot paths (reactive reads, polling).
Example
ts
getCookieValue('theme=dark; sid=a%3Bb', 'sid'); // 'a;b'Signature
ts
declare function getCookieValue(cookie: string, name: string, decode?: (value: string) => string): string | null;Parameters
| Parameter | Type | Description |
|---|---|---|
cookie | string | The cookie string to search |
name | string | The raw (decoded) cookie name to look up |
decode? | (value: string) => string | The raw (decoded) cookie name to look up |
Returns
string | nullThe cookie value, or null when absent