Cogs

JavaScript Toolbox

Cookie

Cogs.cookie

Search for and Create Cookies.

Cogs.cookie( name )

name The key/name of the cookie being searched for.

Cogs.cookie( name, value, options )

name The key/name being updated/created.

value The value to be set for the cookie.

options A key/value to set additional properties of the cookie.

Options

duration The lifespan of the Cookie, in days.

domain The domain the Cookie should be associated to.

path The path the Cookie should be associated to.

secure Set whether the cookie should only be available over secure connections.

Alternate Forms

Cogs.cookie( name, value, duration )

duration A shortcut to set options with just duration.

Cogs.cookie( name, value, expire )

expire A shortcut to set options as {duration: -1}.

Query

Cogs.query

Search Query-Strings.

Cogs.query( name, [ source ] )

name The key/name to search for.

source A substitute query-string to be searched. (Default: location.search)

Time

Cogs.phpdate (phputc)

Local and UTC Date/Time formatting based on the PHP function date.

Cogs.phpdate( format, [ time ] )

Cogs.phputc( format, [ time ] )

format The guide for which the time should be formatted.

time A substitute Date or timestamp to be formatted (Default: Now)

Unsupported Formatting

e Timezone identifier.

T Timezone abbreviation.

Supported Timestamp Range

0001-01-01 00:00:00.000 -- 9999-12-31 23:59:59:999

or -62,167,219,200,000 -- 253,402,300,799,999

Cogs.strftime (strfutc)

Local and UTC Date/Time formatting based on the C/C++ function strftime.

Cogs.strftime( format, [ time ] )

Cogs.strfutc( format, [ time ] )

format The guide for which the time should be formatted.

time A substitute Date or timestamp to be formatted (Default: Now)

Unsupported Formatting

%E Modifier.

%O Modifier.

%Z The time zone or name or abbreviation.

Supported Timestamp Range

0001-01-01 00:00:00.000 -- 9999-12-31 23:59:59:999

or -62,167,219,200,000 -- 253,402,300,799,999

Cogs.time (utc)

The current time, in total milliseconds.

Cogs.time()

Cogs.utc()

Unassuming timestamp creation in local and UTC time.

Cogs.time( year, month, day, hour, minute, second, milli )

Cogs.utc( year, month, day, hour, minute, second, milli )

year The full year, so 1 is year 1, not 2001. (Default: 0)

month The month, from 1 - 12. (Default: 1)

day The day, from 1 - 31. (Default: 1)

hour The hours, from 0 - 23. (Default: 0)

minute The minutes, from 0 - 59. (Default: 0)

second The seconds, from 0 - 59. (Default: 0)

milli The milliseconds, from 0 - 999. (Default: 0)

Type

Cogs.is_a

Enhanced instanceof testing.

Cogs.is_a( object, compare )

object The object to be compared.

compare The type, constructor, null, or undefined to compare to.

Special Camparison Values

nil Matches null or undefined.

Cogs.isof

Enhanced instanceof testing with multiple possible comparisons.

Cogs.isof( object, compare, [ ... ] )

object The object to be compared.

compare The type or constructor to compare to.

Cogs.type

Enhanced typeof testing.

Cogs.type( object )

object The object to be compared.

Possible, Recognized Types

undefined

null

array

boolean

date

error

function

number

object

regexp

string

unknown