lib/cookies.js
function(name, value, expires, path, domain, httponly) {
    if (!name) {
        throw new Error("A name is required to create a cookie.");
    }

    // Parse date to timestamp - consider it never expiring if timestamp is not
    // passed to the function
    if (expires) {

        if (typeof expires !== "number") {
            expires = (new Date(expires)).getTime();
        }

    } else {
        expires = -1;
    }

    this.name = name;
    this.value = value || "";
    this.expires = expires;
    this.path = path || "/";
    this.domain = domain || "*";
    this.httponly = Boolean(httponly);
}
function(name, value, expires, path, domain, httponly) {
    if (!name) {
        throw new Error("A name is required to create a cookie.");
    }

    // Parse date to timestamp - consider it never expiring if timestamp is not
    // passed to the function
    if (expires) {

        if (typeof expires !== "number") {
            expires = (new Date(expires)).getTime();
        }

    } else {
        expires = -1;
    }

    this.name = name;
    this.value = value || "";
    this.expires = expires;
    this.path = path || "/";
    this.domain = domain || "*";
    this.httponly = Boolean(httponly);
}
function ( name , value , expires , path , domain , httponly ) { if ( ! name ) { throw new Error ( "A name is required to create a cookie." ) ; } // Parse date to timestamp - consider it never expiring if timestamp is not // passed to the function if ( expires ) { if ( typeof expires !== "number" ) { expires = ( new Date ( expires ) ) . getTime ( ) ; } } else { expires = - 1 ; } this . name = name ; this . value = value || "" ; this . expires = expires ; this . path = path || "/" ; this . domain = domain || "*" ; this . httponly = Boolean ( httponly ) ; }
Creates a new cookies
@class
@param {String} name                       Name of the new cookie
@param {String} value                      Value of the new cookie
@param {String|Number} expires             Expiry timestamp of the new cookie in milliseconds
@param {String} [path="/"]                 Limits cookie to a path
@param {String} [domain="*"]               Limits cookie to a domain
@param {Boolean} [httponly=false]          Specifies whether to include the HttpOnly flag
Creates a new cookies