1.0.7 • Published 7 years ago

biscuit.js v1.0.7

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Biscuit

A simple JavaScript lib for handling cookies.

Basic Usage

Read

Read cookie:

biscuit.get('name') // => 'value'
biscuit.get('nothing') // => null

Read all visible cookie

biscuit.get() // => { name1 : 'value1', name2 : 'value2' }

Create

Create a cookie, valid across the entire site:

biscuit.set('name', 'value')

Create a cookie that expires 7 days from now, valid across the entire site:

biscuit.set('name', 'value', { expires: 7 }) // expires 7 days

Create a cookie that should be visible to a specific domain:

biscuit.set('name', 'value', { domain: 'example.com' })

Create a cookie, valid to the path of the current page:

biscuit.set('name', 'value', { path: '/'} )

Create a cookie that only be transmitted over secure protocol as https:

biscuit.set('name', 'value', { secure: true })

Remove

Remove a cookie:

biscuit.remove('name')

Remove a cookie with spcefic path or domain:

biscuit.remove('name', { path: '', domain: 'example.com'})

When deleting a cookie, you must pass the exact same path and domain attributes that was used to set the cookie.

Authors

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago