You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

set-cookie-parser

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-cookie-parser - npm Package Compare versions

Comparing version
3.0.1
to
3.1.0
+119
lib/set-cookie.d.ts
export interface Cookie {
/** Cookie name */
name: string;
/** Cookie value */
value: string;
/** Cookie path */
path?: string;
/** Absolute expiration date for the cookie */
expires?: Date;
/**
* Relative max age of the cookie in seconds from when the client receives it.
* Note: when using with express's res.cookie() method, multiply maxAge by 1000 to convert to milliseconds.
*/
maxAge?: number;
/**
* Domain for the cookie,
* may begin with "." to indicate the named domain or any subdomain of it
*/
domain?: string;
/** Indicates that this cookie should only be sent over HTTPS */
secure?: boolean;
/** Indicates that this cookie should not be accessible to client-side JavaScript */
httpOnly?: boolean;
/** Indicates a cookie ought not to be sent along with cross-site requests */
sameSite?: string;
/** Indicates the cookie should be stored using partitioned storage */
partitioned?: boolean;
}
export interface CookieMap {
[name: string]: Cookie;
}
export interface Options {
/**
* Calls decodeURIComponent on each value.
* @default true
*/
decodeValues?: boolean;
/**
* Return an object instead of an array.
* @default false
*/
map?: boolean;
/**
* Suppress the warning that is logged when called on a request instead of a response.
* @default false
*/
silent?: boolean;
/**
* Controls whether combined cookie strings are split.
* - `true`: always split
* - `false`: never split
* - `"auto"`: split strings but not arrays
* @default "auto"
*/
split?: boolean | "auto";
}
/** Object with a `headers` property (e.g. Node.js IncomingMessage or fetch Response) */
type ResponseLike = {
headers:
| { getSetCookie(): string[] }
| { "set-cookie"?: string | readonly string[] }
| Record<string, string | string[] | undefined>;
};
type SetCookieInput = string | readonly string[] | ResponseLike;
/**
* Parses set-cookie headers into objects.
*/
export function parseSetCookie(
input: SetCookieInput,
options: Options & { map: true }
): CookieMap;
export function parseSetCookie(
input: SetCookieInput,
options?: Options & { map?: false }
): Cookie[];
export function parseSetCookie(
input: SetCookieInput,
options?: Options
): Cookie[] | CookieMap;
/**
* Parses a single set-cookie header value string.
* @deprecated Use `parseSetCookie` instead.
*/
export function parseString(
setCookieValue: string,
options?: Options
): Cookie | null;
/**
* Splits a combined set-cookie header string into individual set-cookie header strings.
* @deprecated Use `parseSetCookie` with the `split` option instead.
*/
export function splitCookiesString(
input: string | readonly string[] | undefined
): string[];
/**
* @deprecated Renamed to `parseSetCookie`. Kept for backward compatibility.
*/
export {
parseSetCookie as parse,
};
/**
* Default export — the `parseSetCookie` function with additional properties for backward compatibility.
*/
declare const _default: typeof parseSetCookie & {
parseSetCookie: typeof parseSetCookie;
parse: typeof parseSetCookie;
parseString: typeof parseString;
splitCookiesString: typeof splitCookiesString;
};
export default _default;
+8
-4
{
"name": "set-cookie-parser",
"version": "3.0.1",
"version": "3.1.0",
"description": "Parses set-cookie headers into objects",

@@ -17,5 +17,7 @@ "homepage": "https://github.com/nfriedly/set-cookie-parser",

"module": "./lib/set-cookie.js",
"types": "./lib/set-cookie.d.ts",
"type": "module",
"exports": {
".": {
"types": "./lib/set-cookie.d.ts",
"module-sync": "./lib/set-cookie.js",

@@ -41,10 +43,12 @@ "import": "./lib/set-cookie.js",

"husky": "^9.1.7",
"mocha": "^10.3.0",
"mocha": "^11.7.5",
"prettier": "^3.2.5",
"pretty-quick": "^4.0.0",
"sinon": "^17.0.1"
"sinon": "^21.0.3",
"tsd": "^0.33.0"
},
"scripts": {
"lint": "eslint . --ignore-pattern '!.eslintrc.js'",
"test": "npm run build && npm run lint && mocha",
"test": "npm run build && npm run lint && mocha && npm run typecheck",
"typecheck": "tsd",
"autofix": "npm run lint -- --fix",

@@ -51,0 +55,0 @@ "format": "npm run lint -- --fix",