Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

cookie-es

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-es - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

77

dist/index.d.ts

@@ -103,3 +103,3 @@ /**

/**
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
* Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](https://datatracker.ietf.org/doc/html/draft-cutler-httpbis-partitioned-cookies#section-2.1)
* attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the

@@ -111,3 +111,3 @@ * `Partitioned` attribute is not set.

*
* More information about can be found in [the proposal](https://github.com/privacycg/CHIPS)
* More information can be found in the [proposal](https://github.com/privacycg/CHIPS).
*/

@@ -133,2 +133,6 @@ partitioned?: boolean;

decode?(value: string): string;
/**
* Custom function to filter parsing specific keys.
*/
filter?(key: string): boolean;
}

@@ -144,2 +148,3 @@

declare function parse(str: string, options?: CookieParseOptions): Record<string, string>;
/**

@@ -155,2 +160,68 @@ * Serialize a cookie name-value pair into a `Set-Cookie` header string.

export { type CookieParseOptions, type CookieSerializeOptions, parse, serialize };
interface SetCookieParseOptions {
/**
* Custom decode function to use on cookie values.
*
* By default, `decodeURIComponent` is used.
*
* **Note:** If decoding fails, the original (undecoded) value will be used
*/
decode?: false | ((value: string) => string);
}
interface SetCookie {
/**
* Cookie name
*/
name: string;
/**
* Cookie value
*/
value: string;
/**
* Cookie path
*/
path?: string | undefined;
/**
* Absolute expiration date for the cookie
*/
expires?: Date | undefined;
/**
* Relative max age of the cookie in seconds from when the client receives it (integer or undefined)
*
* Note: when using with express's res.cookie() method, multiply maxAge by 1000 to convert to milliseconds
*/
maxAge?: number | undefined;
/**
* Domain for the cookie,
* May begin with "." to indicate the named domain or any subdomain of it
*/
domain?: string | undefined;
/**
* Indicates that this cookie should only be sent over HTTPs
*/
secure?: boolean | undefined;
/**
* Indicates that this cookie should not be accessible to client-side JavaScript
*/
httpOnly?: boolean | undefined;
/**
* Indicates a cookie ought not to be sent along with cross-site requests
*/
sameSite?: string | undefined;
[key: string]: unknown;
}
/**
* Parse a [Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header string into an object.
*/
declare function parseSetCookie(setCookieValue: string, options?: SetCookieParseOptions): SetCookie;
/**
* Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
* that are within a single set-cookie field-value, such as in the Expires portion.
*
* See https://tools.ietf.org/html/rfc2616#section-4.2
*/
declare function splitSetCookieString(cookiesString: string | string[]): string[];
export { type CookieParseOptions, type CookieSerializeOptions, type SetCookie, type SetCookieParseOptions, parse, parseSetCookie, serialize, splitSetCookieString };

39

package.json
{
"name": "cookie-es",
"version": "1.1.0",
"version": "1.2.0",
"repository": "unjs/cookie-es",

@@ -10,5 +10,10 @@ "license": "MIT",

".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}

@@ -18,3 +23,3 @@ },

"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"types": "./dist/index.d.cts",
"files": [

@@ -25,5 +30,5 @@ "dist"

"build": "unbuild",
"dev": "vitest",
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test",
"lint:fix": "automd && eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w",
"dev": "vitest --coverage",
"lint": "eslint --cache . && prettier -c src test",
"lint:fix": "automd && eslint --cache . --fix && prettier -c src test -w",
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",

@@ -33,13 +38,13 @@ "test": "pnpm lint && vitest run --coverage"

"devDependencies": {
"@vitest/coverage-v8": "^1.4.0",
"automd": "^0.3.7",
"@vitest/coverage-v8": "^2.0.3",
"automd": "^0.3.8",
"changelogen": "^0.5.5",
"eslint": "^8.57.0",
"eslint-config-unjs": "^0.2.1",
"prettier": "^3.2.5",
"typescript": "^5.4.3",
"eslint": "^9.7.0",
"eslint-config-unjs": "^0.3.2",
"prettier": "^3.3.3",
"typescript": "^5.5.3",
"unbuild": "^2.0.0",
"vitest": "^1.4.0"
"vitest": "^2.0.3"
},
"packageManager": "pnpm@8.15.5"
}
"packageManager": "pnpm@9.5.0"
}
# cookie-es
# 🍪 cookie-es

@@ -12,3 +12,3 @@ <!-- automd:badges bundlejs -->

ESM build of [cookie](https://www.npmjs.com/package/cookie) with bundled types.
🍪 [`Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie) and [`Set-Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) parser and serializer based on [cookie](https://github.com/jshttp/cookiee) and [set-cookie-parser](https://github.com/nfriedly/set-cookie-parser) with dual ESM/CJS exports and bundled types. 🎁

@@ -48,3 +48,8 @@ ## Usage

```js
import { parse, serialize } from "cookie-es";
import {
parse,
serialize,
parseSetCookie,
splitSetCookieString,
} from "cookie-es";
```

@@ -55,3 +60,8 @@

```js
const { parse, serialize } = require("cookie-es");
const {
parse,
serialize,
parseSetCookie,
splitSetCookieString,
} = require("cookie-es");
```

@@ -62,3 +72,8 @@

```js
import { parse, serialize } from "https://esm.sh/cookie-es";
import {
parse,
serialize,
parseSetCookie,
splitSetCookieString,
} from "https://esm.sh/cookie-es";
```

@@ -65,0 +80,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc