Creates a new CookieMap instance.
constructor
CookieMap.constructor
Optional initial data for the cookie map:
- string: A cookie header string (e.g., "name=value; foo=bar")
- string[][]: An array of name/value pairs (e.g., [["name", "value"], ["foo", "bar"]])
- Record<string, string>: An object with cookie names as keys (e.g., { name: "value", foo: "bar" })
Referenced types
class CookieMap
A Map-like interface for working with collections of cookies.
Implements the Iterable
interface, allowing use with for...of
loops.
Returns the default iterator for the CookieMap. Used by for...of loops to iterate over all entries.
@returnsAn iterator for the entries in the map
- @param name
The name of the cookie to delete
@param optionsThe options for the cookie to delete
name: string,): void;Removes a cookie from the map.
@param nameThe name of the cookie to delete
@param optionsThe options for the cookie to delete
Returns an iterator of [name, value] pairs for every cookie in the map.
@returnsAn iterator for the entries in the map
- @param name
The name of the cookie to retrieve
@returnsThe cookie value as a string, or null if the cookie doesn't exist
- @param name
The name of the cookie to check
@returnstrue if the cookie exists, false otherwise
Returns an iterator of all cookie names in the map.
@returnsAn iterator for the cookie names
- @param name
The name of the cookie
@param valueThe value of the cookie
@param optionsOptional cookie attributes
@param optionsCookie options including name and value
Converts the cookie map to a serializable format.
@returnsAn array of name/value pairs
Gets an array of values for Set-Cookie headers in order to apply all changes to cookies.
@returnsAn array of values for Set-Cookie headers
Returns an iterator of all cookie values in the map.
@returnsAn iterator for the cookie values