<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Bluzzi</title>
    <description>The latest articles on Forem by Bluzzi (@bluzzi).</description>
    <link>https://forem.com/bluzzi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F657613%2F40c2c961-f386-4a16-a34e-9e211f020f23.png</url>
      <title>Forem: Bluzzi</title>
      <link>https://forem.com/bluzzi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bluzzi"/>
    <language>en</language>
    <item>
      <title>[JS/TS] Cookie Muncher - Effortless cookie management</title>
      <dc:creator>Bluzzi</dc:creator>
      <pubDate>Thu, 27 Apr 2023 03:14:36 +0000</pubDate>
      <link>https://forem.com/bluzzi/jsts-cookie-muncher-effortless-cookie-management-1nfn</link>
      <guid>https://forem.com/bluzzi/jsts-cookie-muncher-effortless-cookie-management-1nfn</guid>
      <description>&lt;p&gt;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 &lt;code&gt;Cookie&lt;/code&gt; and &lt;code&gt;Set-Cookie&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;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 &lt;a href="https://datatracker.ietf.org/doc/html/rfc6265"&gt;RFC 6265&lt;/a&gt;, not complete enough and usable on both server and client side or simply don't have a good API...&lt;/p&gt;

&lt;p&gt;That's why I created my own package : &lt;a href="https://github.com/Bluzzi/cookie-muncher"&gt;&lt;strong&gt;Cookie Muncher&lt;/strong&gt;&lt;/a&gt;! A lightweight and typesafe package for manipulating cookies in NodeJS and the browser.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🚀 Lightweight&lt;/li&gt;
&lt;li&gt;🌏 Works in all browsers&lt;/li&gt;
&lt;li&gt;🧪 Unit tested
&lt;/li&gt;
&lt;li&gt;🔷 Typesafe&lt;/li&gt;
&lt;li&gt;📦 Support ESM &amp;amp; CJS
&lt;/li&gt;
&lt;li&gt;✅ &lt;a href="https://datatracker.ietf.org/doc/html/rfc6265"&gt;RFC 6265&lt;/a&gt; compliant&lt;/li&gt;
&lt;li&gt;📖 Well documented&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This package is divided into two modules.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;httpCookie&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Serialize and parse cookie from HTTP headers &lt;code&gt;Cookie&lt;/code&gt; and Set-&lt;code&gt;Cookie&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#httpcookieserializecookie-cookie-options-httpcookieoptions-string"&gt;&lt;code&gt;httpCookie.serialize(cookie: Cookie, options?: HttpCookieOptions): string&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#httpcookieparsecookies-string-cookie"&gt;&lt;code&gt;httpCookie.parse(cookies: string): Cookie[]&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#httpcookieoptions--domcookieoptions"&gt;&lt;code&gt;HttpCookieOptions&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;domCookie&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Create, update, remove and get cookies from browser DOM.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#domcookiesetcookie-cookie-options-domcookieoptions-void"&gt;&lt;code&gt;domCookie.set(cookie: Cookie, options?: DomCookieOptions): void&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#domcookiegetname-string-cookie--null"&gt;&lt;code&gt;domCookie.get(name: string): Cookie | null&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#domcookiegetall-cookie"&gt;&lt;code&gt;domCookie.getAll(): Cookie[]&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#domcookieremovename-string-options-domcookieoptions-void"&gt;&lt;code&gt;domCookie.remove(name: string, options?: DomCookieOptions): void&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/Bluzzi/cookie-muncher#httpcookieoptions--domcookieoptions"&gt;&lt;code&gt;DomCookieOptions&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This package will definitely be your best friend the next time you need to use cookies! 🍪&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# NPM&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;cookie-muncher

&lt;span class="c"&gt;# YARN&lt;/span&gt;
yarn add cookie-muncher

&lt;span class="c"&gt;# PNPM&lt;/span&gt;
pnpm &lt;span class="nb"&gt;install &lt;/span&gt;cshookie-muncher
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Feel free to drop a ⭐ on the &lt;a href="https://github.com/Bluzzi/cookie-muncher"&gt;GitHub repo&lt;/a&gt; or contribute! 😀&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>npm</category>
      <category>cookie</category>
    </item>
  </channel>
</rss>
