Cookie component
JavaScript CSS Other
Switch branches/tags
Latest commit 179f85d Nov 10, 2016 @stephenmathieson stephenmathieson Release 1.1.3
Permalink
Failed to load latest commit information.
test Ignore URIError Oct 24, 2014
.gitignore gitignore: add node_modules Apr 29, 2015
History.md Release 1.1.3 Nov 10, 2016
Makefile refactor Dec 13, 2012
Readme.md Specify unit for maxage Jan 9, 2013
component.json Release 1.1.3 Nov 10, 2016
index.js wrap `document.cookie` in a try/catch Apr 29, 2015
package.json Release 1.1.3 Nov 10, 2016

Readme.md

cookie

Cookie component.

Installation

$ component install component/cookie

Example

// set
cookie('name', 'tobi')
cookie('name', 'tobi', { path: '/' })
cookie('name', 'tobi', { maxage: 60000 }) // in milliseconds
cookie('species', 'ferret')

// get
var name = cookie('name')
// => "tobi"

var cookies = cookie()
// => { name: "tobi", species: "ferret" }

// clear
cookie('name', null)

License

MIT