1.0.0 • Published 3 years ago

h-cookie v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

h-cookie

Install

    npm install h-cookie --save

Not 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') // => undefined

Remove cookie:

hCookie.det("name"); // => null