whole_func_string: function getPurchasesBySite( purchases, sites ) {
  	return purchases
  		.reduce( ( result, currentValue ) => {
  			const site = find( result, { id: currentValue.siteId } );
  			if ( site ) {
  				site.purchases = site.purchases.concat( currentValue );
  			} else {
  				const siteObject = find( sites, { ID: currentValue.siteId } );
  
  				result = result.concat( {
  					id: currentValue.siteId,
  					name: currentValue.siteName,
  					/* if the purchase is attached to a deleted site,
  					 * there will be no site with this ID in `sites`, so
  					 * we fall back on the domain. */
  					slug: siteObject ? siteObject.slug : currentValue.domain,
  					isDomainOnly: siteObject ? siteObject.options.is_domain_only : false,
  					title: currentValue.siteName || currentValue.domain || '',
  					purchases: [ currentValue ],
  					domain: siteObject ? siteObject.domain : currentValue.domain,
  				} );
  			}
  
  			return result;
  		}, [] )
  		.sort( ( a, b ) => ( a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1 ) );
  }
func_code_string: function getPurchasesBySite( purchases, sites ) {
  	return purchases
  		.reduce( ( result, currentValue ) => {
  			const site = find( result, { id: currentValue.siteId } );
  			if ( site ) {
  				site.purchases = site.purchases.concat( currentValue );
  			} else {
  				const siteObject = find( sites, { ID: currentValue.siteId } );
  
  				result = result.concat( {
  					id: currentValue.siteId,
  					name: currentValue.siteName,
  					/* if the purchase is attached to a deleted site,
  					 * there will be no site with this ID in `sites`, so
  					 * we fall back on the domain. */
  					slug: siteObject ? siteObject.slug : currentValue.domain,
  					isDomainOnly: siteObject ? siteObject.options.is_domain_only : false,
  					title: currentValue.siteName || currentValue.domain || '',
  					purchases: [ currentValue ],
  					domain: siteObject ? siteObject.domain : currentValue.domain,
  				} );
  			}
  
  			return result;
  		}, [] )
  		.sort( ( a, b ) => ( a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1 ) );
  }
func_documentation_string: Returns an array of sites objects, each of which contains an array of purchases.
  
  @param {array} purchases An array of purchase objects.
  @param {array} sites An array of site objects
  @return {array} An array of sites with purchases attached.