lib/abaaso.js
function ( xhr, type ) {
		type = type || "";
		var result, obj;

		if ( ( regex.json_maybe.test( type ) || string.isEmpty( type ) ) && ( regex.json_wrap.test( xhr.responseText ) && Boolean( obj = json.decode( xhr.responseText, true ) ) ) ) {
			result = obj;
		}
		else if ( regex.xml.test( type ) ) {
			if ( type !== "text/xml" ) {
				xhr.overrideMimeType( "text/xml" );
			}

			result = xhr.responseXML;
		}
		else if ( type === "text/plain" && regex.is_xml.test( xhr.responseText) && xml.valid( xhr.responseText ) ) {
			result = xml.decode( xhr.responseText );
		}
		else {
			result = xhr.responseText;
		}

		return result;
	}
function ( xhr, type ) {
		type = type || "";
		var result, obj;

		if ( ( regex.json_maybe.test( type ) || string.isEmpty( type ) ) && ( regex.json_wrap.test( xhr.responseText ) && Boolean( obj = json.decode( xhr.responseText, true ) ) ) ) {
			result = obj;
		}
		else if ( regex.xml.test( type ) ) {
			if ( type !== "text/xml" ) {
				xhr.overrideMimeType( "text/xml" );
			}

			result = xhr.responseXML;
		}
		else if ( type === "text/plain" && regex.is_xml.test( xhr.responseText) && xml.valid( xhr.responseText ) ) {
			result = xml.decode( xhr.responseText );
		}
		else {
			result = xhr.responseText;
		}

		return result;
	}
function ( xhr , type ) { type = type || "" ; var result , obj ; if ( ( regex . json_maybe . test ( type ) || string . isEmpty ( type ) ) && ( regex . json_wrap . test ( xhr . responseText ) && Boolean ( obj = json . decode ( xhr . responseText , true ) ) ) ) { result = obj ; } else if ( regex . xml . test ( type ) ) { if ( type !== "text/xml" ) { xhr . overrideMimeType ( "text/xml" ) ; } result = xhr . responseXML ; } else if ( type === "text/plain" && regex . is_xml . test ( xhr . responseText ) && xml . valid ( xhr . responseText ) ) { result = xml . decode ( xhr . responseText ) ; } else { result = xhr . responseText ; } return result ; }
Parses an XHR response

@method parse
@param  {Object} xhr  XHR Object
@param  {String} type [Optional] Content-Type header value
@return {Mixed}       Array, Boolean, Document, Number, Object or String
Parses an XHR response