delightful-cookies

2.0.3 • Public • Published

delightful-cookies

A standalone module for dealing with cookies client side.

##Example

var dc = require('delightful-cookies');

dc.set('Token', 'j981hf8h1duhsad', 120000);

var cookie = dc.get('Token');

dc.remove('Token');

##Methods

####get(cookieName) returns a string of the cookie's value

dc.set('cookie', 'h348fh39fskjh3')

var cookie = dc.get('cookie')
// cookie => 'h348fh39fskjh3'

####getAll() Retrieves all cookies in the browser as an array of cookie objects.

var cookies = dc.getAll()
// cookies => [{name: 'cookie', value: 'j9812h9ufbwad79'}, {name: 'cookie2', value: '8932hiuhasfdu'}]

####set(name, value[, lifetime]) creates a cookie with name and value that will last until lifetime in minutes. if lifetime is not set, the cookie will last forever.

dc.set('Token', 'oisudfjaf89h12fds'[, 15]);

####remove(name) Removes the cookie that matches the name provided.

dc.remove('Token');

####removeAll() Removes all cookies from browser.

dc.removeAll()

Package Sidebar

Install

npm i delightful-cookies

Weekly Downloads

17

Version

2.0.3

License

ISC

Last publish

Collaborators

  • jc14