@superherocheesecake/cookie
v3.0.5
Published
Small helper for Cookie management
Downloads
7
Maintainers
Keywords
Readme
Cookie
Small helper for Cookie management
Get the package
npm i --save @superherocheesecake/cookie
Import
import { cookie } from '@superherocheesecake/cookie';
Basic Usage
cookie.set(name, value, options);
cookie.get(name); // returned values will always be strings
cookie.remove(name);
Options
path
default is /
path=path
domain
domain=domain
max-age
max-age=max-age-in-seconds
expires
Use this if you want to set an expiry date. If you don't set this value it will be a session cookie.
expires=date-in-GMTString-format
samesite
samesite='secure'|'lax'
Methods
Convert days to UTC
cookie.daysToUTC(30);