h-cookie
v1.0.0
Published
A simple API for JavaScript to handle cookie storage
Downloads
6
Maintainers
Readme
h-cookie
Install
npm install h-cookie --saveNot npm install hcookie!!!!!
ES Module
Example for how to import the ES module from another module:
import hCookie from "h-cookie";
hCookie.set('foo', 'bar')Basic Usage
Create a cookie, valid across the entire site:
hCookie.set('name', 'value')Create a cookie that expires 7 days from now, valid across the entire site:
hCookie.set('name', 'value', { expires: 7 })Create an expiring cookie, valid to the path of the current page:
hCookie.set('name', 'value', { expires: 7, path: 'localhost' })Read cookie:
hCookie.get('name') // => 'value'
hCookie.get('nothing') // => undefinedRemove cookie:
hCookie.det("name"); // => null