plugin/boomerang/boomerang-1.0.0.js
/**
	 * Gets compressed content and transfer size information, if available
	 *
	 * @param {ResourceTiming} resource ResourceTiming object
	 *
	 * @returns {string} Compressed data (or empty string, if not available)
	 */
Gets compressed content and transfer size information, if available
@param {ResourceTiming} resource ResourceTiming object

@returns {string} Compressed data (or empty string, if not available)
Gets compressed content and transfer size information if available @param { ResourceTiming } resource ResourceTiming object @returns { string } Compressed data ( or empty string if not available )
function compressSize(resource) {
		var sTrans, sEnc, sDec, sizes;
		if (resource.encodedBodySize ||
			resource.decodedBodySize ||
			resource.transferSize) {
			 transferSize: how many bytes were over the wire. It can be 0 in the case of X-O,
			 or if it was fetched from a cache.
			 encodedBodySize: the size after applying encoding (e.g. gzipped size).  It is 0 if X-O or no content (eg: beacon).
			 decodedBodySize: the size after removing encoding (e.g. the original content size).  It is 0 if X-O or no content (eg: beacon).
			 Here are the possible combinations of values: [encodedBodySize, transferSize, decodedBodySize]
			 Cross-Origin resources w/out Timing-Allow-Origin set: [0, 0, 0] -> [0, 0, 0] -> [empty]
			 204: [0, t, 0] -> [0, t, 0] -> [e, t-e] -> [, t]
			 304: [e, t: t <=> e, d: d>=e] -> [e, t-e, d-e]
			 200 non-gzipped: [e, t: t>=e, d: d=e] -> [e, t-e]
			 200 gzipped: [e, t: t>=e, d: d>=e] -> [e, t-e, d-e]
			 retrieved from cache non-gzipped: [e, 0, d: d=e] -> [e]
			 retrieved from cache gzipped: [e, 0, d: d>=e] -> [e, _, d-e]
			sTrans = resource.transferSize;
			sEnc = resource.encodedBodySize;
			sDec = resource.decodedBodySize;
			 convert to an array
			sizes = [sEnc, sTrans ? sTrans - sEnc : "_", sDec ? sDec - sEnc : 0];
			 change everything to base36 and remove any trailing ,s
			return sizes.map(toBase36).join(",").replace(/,+$/, "");
		}
		else {
			return "";
		}
	}
function compressSize ( resource ) { var sTrans , sEnc , sDec , sizes ; if ( resource . encodedBodySize || resource . decodedBodySize || resource . transferSize ) { sTrans = resource . transferSize ; sEnc = resource . encodedBodySize ; sDec = resource . decodedBodySize ; sizes = [ sEnc , sTrans ? sTrans - sEnc : "_" , sDec ? sDec - sEnc : 0 ] ; return sizes . map ( toBase36 ) . join ( "," ) . replace ( / ,+$ / , "" ) ; } else { return "" ; } }
Gets compressed content and transfer size information, if available
 @param {ResourceTiming} resource ResourceTiming object
Gets compressed content and transfer size information if available @param { ResourceTiming } resource ResourceTiming object
// check to see if we can add content sizes // // transferSize: how many bytes were over the wire. It can be 0 in the case of X-O, // or if it was fetched from a cache. // // encodedBodySize: the size after applying encoding (e.g. gzipped size).  It is 0 if X-O or no content (eg: beacon). // // decodedBodySize: the size after removing encoding (e.g. the original content size).  It is 0 if X-O or no content (eg: beacon). // // Here are the possible combinations of values: [encodedBodySize, transferSize, decodedBodySize] // // Cross-Origin resources w/out Timing-Allow-Origin set: [0, 0, 0] -> [0, 0, 0] -> [empty] // 204: [0, t, 0] -> [0, t, 0] -> [e, t-e] -> [, t] // 304: [e, t: t <=> e, d: d>=e] -> [e, t-e, d-e] // 200 non-gzipped: [e, t: t>=e, d: d=e] -> [e, t-e] // 200 gzipped: [e, t: t>=e, d: d>=e] -> [e, t-e, d-e] // retrieved from cache non-gzipped: [e, 0, d: d=e] -> [e] // retrieved from cache gzipped: [e, 0, d: d>=e] -> [e, _, d-e] // // convert to an array // change everything to base36 and remove any trailing ,s