Skip to content

jc14/delightful-cookies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

delightful-cookies

A standalone module for dealing with cookies client side.

npm install delightful-cookies --save

##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()

About

A standalone module for dealing with cookies client side.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published