Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cookie-es

unjs4.3mMIT1.2.2TypeScript support: included

readme

🍪 cookie-es

npm version npm downloads bundle size

🍪 Cookie and Set-Cookie parser and serializer based on cookie and set-cookie-parser with dual ESM/CJS exports and bundled types. 🎁

Usage

Install:

# ✨ Auto-detect
npx nypm install cookie-es

# npm
npm install cookie-es

# yarn
yarn add cookie-es

# pnpm
pnpm install cookie-es

# bun
bun install cookie-es

Import:

ESM (Node.js, Bun)

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

CommonJS (Legacy Node.js)

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

CDN (Deno, Bun and Browsers)

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

License

MIT

changelog

Changelog

v1.2.2

compare changes

🩹 Fixes

  • Parse filter code lose (#47)

🏡 Chore

  • Update jshttp link (#46)

❤️ Contributors

v1.2.1

compare changes

🩹 Fixes

  • set-cookie: Compatible sameSite type with parse (2d1c70e)

❤️ Contributors

  • Pooya Parsa (@pi0)

v1.2.0

compare changes

🚀 Enhancements

  • parse: Support filter option for key filtering (#35)
  • Add utils to parse set-cookie (#43)

📖 Documentation

  • Fix links for partitioned attribute of CookieSerializeOptions (#34)

📦 Build

🏡 Chore

❤️ Contributors

v1.1.0

compare changes

🚀 Enhancements

  • Add partitioned option (#21)

🏡 Chore

❤️ Contributors

v1.0.0

🚀 Enhancements

  • Add priority option (8b91b0c)
  • Add types for priority option (e315835)

🔥 Performance

  • Improve default decode speed (8aeac0a)

🩹 Fixes

  • pkg: Add types subpath export (#4)
  • Add explicit return types to exported functions (#2)
  • expires option should reject invalid dates (1a69d74)
  • serialize: Handle maxAge with null value (e4da31d)

🏡 Chore

  • Update repo (c8a3759)
  • Add renovate.json (be32c11)
  • Update lockfile (68814e6)
  • Add codecov.yml (0c2e709)
  • Gitignore .eslintcache (21a077b)
  • Lint (1dc5260)

✅ Tests

  • Add pnpm, vitest and a test for serialising cookie (#3)
  • Port all tests from upstream (#8)

❤️ Contributors