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

Package detail

cookie-es

unjs9.4mMIT2.0.0TypeScript support: included

readme

🍪 cookie-es

npm version npm downloads bundle size install size codecov

ESM ready Cookie and Set-Cookie parser and serializer based on cookie and set-cookie-parser with built-in types.

Usage

Install:

# ✨ Auto-detect (npm, yarn, pnpm, bun, deno)
npx nypm install cookie-es

Import:

ESM (Node.js, Bun, Deno)

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

CDN (Deno, Bun and Browsers)

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

License

MIT

Based on jshttp/cookie (Roman Shtylman and hristopher Wilson) and nfriedly/set-cookie-parser (Nathan Friedly).

changelog

Changelog

v2.0.0

compare changes

📦 Build

🏡 Chore

⚠️ Breaking Changes

❤️ Contributors

  • Pooya Parsa (@pi0)

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