Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 27, 2023 03:14 am GMT

[JS/TS] Cookie Muncher - Effortless cookie management

When we create a website, we always need to use cookies, either on the browser side, or on the server side through the HTTP headers Cookie and Set-Cookie.

The problem is that most of the packages allowing to handle cookies are not maintained anymore, not written in TS, not exported in both CommonJS and ES module, not 100% compliant with RFC 6265, not complete enough and usable on both server and client side or simply don't have a good API...

That's why I created my own package : Cookie Muncher! A lightweight and typesafe package for manipulating cookies in NodeJS and the browser.

  • Lightweight
  • Works in all browsers
  • Unit tested
  • Typesafe
  • Support ESM & CJS
  • RFC 6265 compliant
  • Well documented

This package is divided into two modules.

httpCookie

Serialize and parse cookie from HTTP headers Cookie and Set-Cookie.

domCookie

Create, update, remove and get cookies from browser DOM.

This package will definitely be your best friend the next time you need to use cookies!

# NPMnpm install cookie-muncher# YARNyarn add cookie-muncher# PNPMpnpm install cshookie-muncher

Feel free to drop a on the GitHub repo or contribute!


Original Link: https://dev.to/bluzzi/jsts-cookie-muncher-effortless-cookie-management-1nfn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To