Skip to content

emflores/cookie-crisp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cookie Crisp NPM version

A small cookie utility for getting, setting, and deleting cookies

init( doc )

Initializes cookie-crisp. Can optionally pass in a reference to document that differs from window.document.

get( cookieName, decode )

Returns a cookie value given a cookie name. By default, the cookie value is decoded before being returned.

set( key, value, opts )

Sets a cookie given a key, value, and a set of options:

opts.path

Path to write cookie (default being /).

opts.days

Days from now that you would like the cookie to expire.

opts.expires

Available if you would like to pass your own GMT expiration date.

opts.encode

Whether or not the cookie key/value should be encoded before being set.

remove( cookieName )

Shortcut for setting a cookie's expiration to Thu, 01 Jan 1970 00:00:01 GMT.

About

Get and set browser cookies

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%