1.1.0 • Published 8 years ago

jscookie v1.1.0

Weekly downloads
434
License
ISC
Repository
github
Last release
8 years ago

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');

Set a cookie

// 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..

Get a cookie value

jscookie.get('the_cookie_name');

Expire a cookie value

jscookie.del('the_cookie_name');