nl_tokens: Returns an array of sites objects each of which contains an array of purchases .
pl_tokens: 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 . <mask> . toLowerCase ( ) ? 1 : - 1 ) ) ; }