JSDoc: Module: noop.cookie

noop.cookie

NOOP Cookie module.
Version:
  • 0.100
Author:
  • cisco211
Source:

Methods

(static) all() → {object.<string, string>}

Get an object of all available cookies.

Source:
Returns:
- An object of all available cookies.
Type
object.<string, string>
Example
var all = noop.cookie.all();

(static) def() → {noop.cookie.Defaults}

Return default cookie parameters.

Source:
Returns:
- An object containing the default cookie parameters.
Type
noop.cookie.Defaults
Example
var def = noop.cookie.def();

(static) del(key, optsopt)

Delete a cookie by given name and cookie parameters.

Parameters:
Name Type Attributes Default Description
key string The cookie name.
opts noop.cookie.Defaults <optional>
noop.cookie.def() An object containing cookie parameters.
Source:
Example
noop.cookie.del('foo');

(static) get(key, fallbackopt, rawopt)

Get a cookie by given name.

Parameters:
Name Type Attributes Default Description
key string The cookie name.
fallback any <optional>
null The value, that will return when the given cookie name does not exist.
raw boolean <optional>
false Directly return the string, instead converting the type.
Source:
Example
var get = noop.cookie.get('foo');

(static) has(key) → {boolean}

Check that cookie exists.

Parameters:
Name Type Description
key string The cookie name.
Source:
Returns:
- A boolean indicating if the given cookie exists or not.
Type
boolean
Example
var has = noop.cookie.has('foo');

(static) rw(key, valueopt, optsopt, rawopt)

Get a cookie by given name and create the cookie if not exists using given value.

Parameters:
Name Type Attributes Default Description
key string The cookie name.
value any <optional>
null The cookie value.
opts noop.cookie.Defaults <optional>
noop.cookie.def() An object containing cookie parameters.
raw boolean <optional>
false Directly return the string, instead converting the type.
Source:
Example
var rw = noop.cookie.rw('foo', 'bar');

(static) set(key, valueopt, optsopt)

Set a cookie by given name, value and cookie parameters.

Parameters:
Name Type Attributes Default Description
key string The cookie name.
value any <optional>
null The cookie value.
opts noop.cookie.Defaults <optional>
noop.cookie.def() An object containing cookie parameters.
Source:
Example
noop.cookie.set('foo', true);

Type Definitions

Defaults

Default cookie parameters.

Type:
  • object.<string, any>
Properties:
Name Type Attributes Default Description
comment string | null <optional>
null A comment explaining this cookie.
domain string | null <optional>
null The domain this cookie belongs to.
expires string | null <optional>
null The expiration date.
maxAge string | null <optional>
null The maximum allowed cookie age.
path string | null <optional>
null The URL path this cookie belongs to.
secure boolean <optional>
false Flag that this cookie is only available on HTTPS.
version string | null <optional>
null Cookie version number.
Source: