function filterTransactions(transactions, filter) {
  return transactions
    .filter(v => filter.types.length ? filter.types.indexOf(v.type) > -1 : true)
    .filter(v => filter.direction ? filter.direction === v.direction : true)
    .filter(v => filter.search ? v.creditAddresses.find(address => address.length > 1 && address.toLowerCase().indexOf(filter.search.toLowerCase()) !== -1) != undefined : true);
}
// If empty, all transactions are accepted.
If empty, all transactions are accepted.
If empty all transactions are accepted .
function filterTransactions(transactions, filter) {
  return transactions
    .filter(v => filter.types.length ? filter.types.indexOf(v.type) > -1 : true)
    .filter(v => filter.direction ? filter.direction === v.direction : true)
    .filter(v => filter.search ? v.creditAddresses.find(address => address.length > 1 && address.toLowerCase().indexOf(filter.search.toLowerCase()) !== -1) != undefined : true);
}
function filterTransactions ( transactions , filter ) { return transactions . filter ( v => filter . types . length ? filter . types . indexOf ( v . type ) > - 1 : true ) . filter ( v => filter . direction ? filter . direction === v . direction : true ) . filter ( v => filter . search ? v . creditAddresses . find ( address => address . length > 1 && address . toLowerCase ( ) . indexOf ( filter . search . toLowerCase ( ) ) !== - 1 ) != undefined : true ) ; }
If empty, all transactions are accepted.
If empty all transactions are accepted .