Minima.js API / @minimajs/cookie / cookies / get
Function: get()
ts
function get(name): string | undefined;Defined in: index.ts:114
Retrieves a single cookie value by name.
Parameters
name
string
The cookie name
Returns
string | undefined
The cookie value, or undefined if not found
Example
typescript
const theme = cookies.get("theme");
// theme is string | undefined
const userId = cookies.get("user-id");
if (!userId) {
throw new Error("Not authenticated");
}Since
1.0.0