cookie
2.0.1 · 30 Jun 2026MIT314.8M / weekRepositoryHomepagenpmAtom feed
35 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 2.x · latest line
2.0.0
24 Jun 2026Important: This release moves the package to ESM only. In node 22+ you can
require(esm), and older node versions are not supported.Changed
Switch to ESM (#273)
- removed
Remove deprecated code paths (#272)
The old
parseandstringifymethods have been renamed:parseCookieandstringifySetCookiestringifySetCookieonly supports object mode (e.g.{ name: "", value: "" })
Improvements
Fixed
Omit leading semicolon when stringifying cookies with skipped values
- 1.x
1.0.2
20 Nov 2024Loosen cookie name/value validation
options.priorityused incorrect fallbackAdd import example to README
Fixed
Loosen cookie name/value validation
options.priorityused incorrect fallback
Added
Add import example to README
1.0.0
8 Oct 2024Minimum node.js v18
Uses null prototype object for
parsereturn value
Breaking changes
Use modern JS features, ship TypeScript definition (#175) 1cc64ff
Adds
__esModulemarker, imports need to useimport { parse, serialize }orimport * as cookie
Minimum node.js v18
Uses null prototype object for
parsereturn valueChanges
strictandpriorityto match the lower case strings (i.e.low, notLOWorLow)Require
maxAgeto be an integer usingNumber.isIntegercheckDelegates decode implementation details to
decodeoption (i.e. error handling and quote parsing is defined bydecode)Improve arg/option error messages (#162) e206fd5 @MaoShizhong
Other
Remove
hasOwnProperty, useundefinedcheck for performance (#183) 8f3ee9e @gurgunday
- 0.7.x
0.7.1
3 Oct 2024Allow leading dot for domain
Add fast path for
serializewithout options, useobj.hasOwnPropertywhen parsing
Fixed
Allow leading dot for domain
Although not permitted in the spec, some users expect this to work and user agents ignore the leading dot according to spec
Add fast path for
serializewithout options, useobj.hasOwnPropertywhen parsing
0.7.0
2 Oct 2024Parse cookies ~10% faster
- 0.6.x
0.6.0
7 Nov 2023Add
partitionedoption
- 0.5.x
0.5.0
11 Apr 2022Add
priorityoption
- 0.4.x
0.4.2
2 Feb 2022pref: Read value only when assigning in parse
0.4.1
22 Apr 2020Fix
maxAgeoption to reject invalid values
0.4.0
16 May 2019Add
SameSite=Nonesupport
- 0.3.x
0.3.1
27 May 2016Fix
sameSite: trueto work with draft-7 clients
0.3.0
27 May 2016Add
sameSiteoptionImprove error message when
encodeis not a functionImprove error message when
expiresis not aDate
- 0.2.x
0.2.4
21 May 2016Enable strict mode
Use for loop in parse
Use string concatination for serialization
0.2.3
26 Oct 2015Fix cookie
Max-Ageto never be a floating point number
0.2.2
17 Sep 2015Fix regression when setting empty cookie value
Fix typo in invalid value errors
0.2.1
17 Sep 2015Throw on invalid values provided to
serialize
0.2.0
14 Aug 2015Add
firstPartyOnlyoptionThrow better error for invalid argument to parse
Hoist regular expression
- 0.1.x
0.1.5
17 Sep 2015Fix regression when setting empty cookie value
Fix typo in invalid value errors
0.1.4
17 Sep 2015Throw better error for invalid argument to parse
Throw on invalid values provided to
serialize
0.1.3
20 May 2015- removed
Remove argument reassignments
Reduce the scope of try-catch deopt
- 0.0.x