getCookie()

Retrieves one or more cookies.

This function is valid in v2.0.0 to v2.13.1. This function has been downloaded 24 times.

Parameters

{string|RegExp|undefined|null=} name Optional, Default:undefined
Either the name of the cookie to get or a regular expression matching the names of all of the cookies to get. If undefined or null is supplied that means all cookies should be retrieved.
{*=} opt_defaultValue Optional, Default:undefined
The default value to return in the case that name was a string but the corresponding cookie doesn't exist.

Returns

{*}
If name is a string and matches the name of a cookie, that cookie's value will be returned as a string. If name is a string but doesn't match the name of a cookie opt_defaultValue will be returned. If name is of type RegExp an object containing all of the cookies with names that match the specified regular expression will be returned. If name is undefined or null an object containing all of the cookies will be returned. If an object is returned each key will represent the name of each cookie and each value will be the value of that cookie.

Required Function

This function requires the following function which is included automatically:

  • typeOf()
    Either gets the type of a value or adds a constructor registering its custom type name.