public/javascripts/yui/cookie/cookie.js
function (name /*:String*/, options /*:Variant*/) /*:Variant*/{
        
        var lang = YAHOO.lang,
            converter;
        
        if (lang.isFunction(options)) {
            converter = options;
            options = {};
        } else if (lang.isObject(options)) {
            converter = options.converter;
        } else {
            options = {};
        }
        
        var cookies /*:Object*/ = this._parseCookieString(document.cookie, !options.raw);
        
        if (!lang.isString(name) || name === ""){
            throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");
        }
        
        if (lang.isUndefined(cookies[name])) {
            return null;
        }
        
        if (!lang.isFunction(converter)){
            return cookies[name];
        } else {
            return converter(cookies[name]);
        }
    }
function (name /*:String*/, options /*:Variant*/) /*:Variant*/{
        
        var lang = YAHOO.lang,
            converter;
        
        if (lang.isFunction(options)) {
            converter = options;
            options = {};
        } else if (lang.isObject(options)) {
            converter = options.converter;
        } else {
            options = {};
        }
        
        var cookies /*:Object*/ = this._parseCookieString(document.cookie, !options.raw);
        
        if (!lang.isString(name) || name === ""){
            throw new TypeError("Cookie.get(): Cookie name must be a non-empty string.");
        }
        
        if (lang.isUndefined(cookies[name])) {
            return null;
        }
        
        if (!lang.isFunction(converter)){
            return cookies[name];
        } else {
            return converter(cookies[name]);
        }
    }
function ( name /*:String*/ , options /*:Variant*/ ) /*:Variant*/ { var lang = YAHOO . lang , converter ; if ( lang . isFunction ( options ) ) { converter = options ; options = { } ; } else if ( lang . isObject ( options ) ) { converter = options . converter ; } else { options = { } ; } var cookies /*:Object*/ = this . _parseCookieString ( document . cookie , ! options . raw ) ; if ( ! lang . isString ( name ) || name === "" ) { throw new TypeError ( "Cookie.get(): Cookie name must be a non-empty string." ) ; } if ( lang . isUndefined ( cookies [ name ] ) ) { return null ; } if ( ! lang . isFunction ( converter ) ) { return cookies [ name ] ; } else { return converter ( cookies [ name ] ) ; } }
Returns the cookie value for the given name.
@param {String} name The name of the cookie to retrieve.
@param {Object|Function} options (Optional) An object containing one or more
cookie options: raw (true/false) and converter (a function).
The converter function is run on the value before returning it. The
function is not used if the cookie doesn't exist. The function can be
passed instead of the options object for backwards compatibility.
@return {Variant} If no converter is specified, returns a string or null if
the cookie doesn't exist. If the converter is specified, returns the value
returned from the converter or null if the cookie doesn't exist.
@method get
@static
Returns the cookie value for the given name .