nl_tokens: Removes purchases that are missing from the new purchases array and match the given predicate .
pl_tokens: function removeMissingPurchasesByPredicate ( existingPurchases , newPurchases , predicate ) { return existingPurchases . filter ( purchase => { if ( matches ( predicate ) ( purchase ) && find ( newPurchases , { ID : purchase . ID } ) ) { // this purchase is present in the new array return <mask> ; } if ( ! matches ( predicate ) ( purchase ) ) { // only overwrite remove purchases that match the predicate return true ; } // the purchase doesn't match the predicate or is missing from the array of new purchases return false ; } ) ; }