chocolate-chip

0.1.0 • Public • Published

Chocolate Chip

A tiny CommonJS cookie toolkit.

Install

First install Chocolate Chip in your project root.

$ npm install --save chocolate-chip

Then include in your module using require().

var cookie = require('chocolate-chip');

Use

Set cookie

cookie.set('name', 'value'[, opts]);

Options

opts is an object that allows the following options:

  • end: Maximum cookie age in milliseconds or Infinity. Set as GMTString or Date to specify an end date.
  • path: Path from where the cookie will be readable.
  • domain: Domain from where the cookie will be readable
  • secure: Cookie only transmitted over secure protocols if set to true.

Get cookie

cookie.get('name');

Remove cookie

cookie.remove('name');

Set cookie forever

Shorthand for cookie.set(), sets end to Infinity.

cookie.forever('name', 'value'[, opts]);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i chocolate-chip

      Weekly Downloads

      3

      Version

      0.1.0

      License

      MIT

      Last publish

      Collaborators

      • popmotion
      • inventingwithmonster