dox-foundation-demo node_modules/express/node_modules/connect/lib/middleware/session/cookie.js

utils

declaration
utils

    Description

    Module dependencies.

    Source

    var utils = require('../../utils')
      , cookie = require('cookie');
    • @param: {Date}date

    Description

    Set expires date.

    Source

    set expires(date) {
        this._expires = date;
        this.originalMaxAge = this.maxAge;
      },
    • @return: {Date}

    Description

    Get expires date.

    Source

    get expires() {
        return this._expires;
      },
    • @param: {Number}ms

    Description

    Set expires via max-age in ms.

    Source

    set maxAge(ms) {
        this.expires = 'number' == typeof ms
          ? new Date(Date.now() + ms)
          : ms;
      },
    • @return: {Number}

    Description

    Get expires max-age in ms.

    Source

    get maxAge() {
        return this.expires instanceof Date
          ? this.expires.valueOf() - Date.now()
          : this.expires;
      },
    • @return: {String}

    Description

    Return a serialized cookie string.

    Source

    serialize: function(name, val){
        return cookie.serialize(name, val, this.data);
      },