Skip to content

Cookie Jar

Cookie Jar is a basic cookie handling package that allows set, get, and forget functionality.

Installation

$ pnpm add @mvps-genesis/cookie-jar

Example Usage

.js

import CookieJar from '@mvps-genesis/cookie-jar';

// Third parameter is the cookie expiration time in hours.
CookieJar.setCookie('myCookie', 'COOKIE_VALUE_HERE', 1);

const myCookie = CookieJar.getCookie('myCookie');

// Sets cookie expiration to -1 effectively deleting the cookie.
CookieJar.forgetCookie('myCookie');