src/cookies.js
function get_cookies(url) {
	debug.assert(url).is('object');
	debug.assert(url.host).is('string');

	if(!is.array(_cookies[url.host])) {
		//debug.log('No cookies for host ', url.host);
		return undefined;
	}

	var cookies = ARRAY(_cookies[url.host]).map(function(cookie) {
		var i = cookie.indexOf(';');
		return cookie.substr(0, ((i >= 1) ? i : cookie.length));
	}).valueOf();

	//debug.log('Cookies found (for host ', url.host ,'): ', cookies);

	return cookies;
}
function get_cookies(url) {
	debug.assert(url).is('object');
	debug.assert(url.host).is('string');

	if(!is.array(_cookies[url.host])) {
		//debug.log('No cookies for host ', url.host);
		return undefined;
	}

	var cookies = ARRAY(_cookies[url.host]).map(function(cookie) {
		var i = cookie.indexOf(';');
		return cookie.substr(0, ((i >= 1) ? i : cookie.length));
	}).valueOf();

	//debug.log('Cookies found (for host ', url.host ,'): ', cookies);

	return cookies;
}
function get_cookies ( url ) { debug . assert ( url ) . is ( 'object' ) ; debug . assert ( url . host ) . is ( 'string' ) ; if ( ! is . array ( _cookies [ url . host ] ) ) { //debug.log('No cookies for host ', url.host); return undefined ; } var cookies = ARRAY ( _cookies [ url . host ] ) . map ( function ( cookie ) { var i = cookie . indexOf ( ';' ) ; return cookie . substr ( 0 , ( ( i >= 1 ) ? i : cookie . length ) ) ; } ) . valueOf ( ) ; //debug.log('Cookies found (for host ', url.host ,'): ', cookies); return cookies ; }
Get Cookie header line for an URL
@params url {object} The parsed object
Get Cookie header line for an URL