function filterByTags(docs, tags) {
  return tags && tags.length > 0
    ? docs.filter(tx => intersection(tx.tags, tags).length > 0)
    : docs;
}
Filter transactions by tag.

@param {array} docs
@param {array} tags
@return {array}