Creates a new CookieMap instance.
Symbol
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
Removes a cookie from the map.
@param optionsThe options for the cookie to delete
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
Gets the value of a cookie with the specified name.
@param nameThe name of the cookie to retrieve
@returnsThe cookie value as a string, or null if the cookie doesn't exist
Checks if a cookie with the given name exists.
@param nameThe 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
Adds or updates a cookie in the map.
@param nameThe name of the cookie
@param valueThe value of the cookie
@param optionsOptional cookie attributes
Adds or updates a cookie in the map using a cookie options object.
@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