npm.io
1.1.0 • Published 10 years ago

jscookie

Licence
ISC
Version
1.1.0
Deps
0
Vulns
0
Weekly
0
Stars
1

jscookie

A tiny js cookie utility to get, set, and expire cookies.

How to use

Install

  • NPM: npm install jscookie
Import the module
var jscookie = require('jscookie');
// Simple Session Cookie
jscookie.set({
	name   : 'the_cookie_name',
	value  : 'cookie value'
});

or

// Advanced Options
jscookie.set({
	name   : 'the_cookie_name',
	value  : 'cookie value',
	exdays : 5; 
	path   : '/',
	domain : 'http://thisdomain.com'
});

Setting a cookie exdays to false, or ommitting the property, will create a session only cookie..

jscookie.get('the_cookie_name');
jscookie.del('the_cookie_name');

Keywords