lib/packs.js
function (filter) {
    if (cardCount > 0) {
      return cardCount;
    }
    else {
      cardCount = 0;
  
      if (filter) {
        filter = filter.toLowerCase();
  
        _.each(_.keys(cardPacks), function (packKey) {
          _.each(_.keys(cardPacks[packKey].cards), function (cardKey) {
            var card = cardPacks[packKey].cards[cardKey];
  
            if (Fuzzy(filter, card.name.toLowerCase())) {
              cardCount = cardCount + 1;
            }
          });
        });
      }
      else {
        _.each(_.keys(cardPacks), function (packKey) {
          cardCount = cardCount + _.keys(cardPacks[packKey].cards).length;
        });
      }
  
      return cardCount;
    }
  }
function (filter) {
    if (cardCount > 0) {
      return cardCount;
    }
    else {
      cardCount = 0;
  
      if (filter) {
        filter = filter.toLowerCase();
  
        _.each(_.keys(cardPacks), function (packKey) {
          _.each(_.keys(cardPacks[packKey].cards), function (cardKey) {
            var card = cardPacks[packKey].cards[cardKey];
  
            if (Fuzzy(filter, card.name.toLowerCase())) {
              cardCount = cardCount + 1;
            }
          });
        });
      }
      else {
        _.each(_.keys(cardPacks), function (packKey) {
          cardCount = cardCount + _.keys(cardPacks[packKey].cards).length;
        });
      }
  
      return cardCount;
    }
  }
function ( filter ) { if ( cardCount > 0 ) { return cardCount ; } else { cardCount = 0 ; if ( filter ) { filter = filter . toLowerCase ( ) ; _ . each ( _ . keys ( cardPacks ) , function ( packKey ) { _ . each ( _ . keys ( cardPacks [ packKey ] . cards ) , function ( cardKey ) { var card = cardPacks [ packKey ] . cards [ cardKey ] ; if ( Fuzzy ( filter , card . name . toLowerCase ( ) ) ) { cardCount = cardCount + 1 ; } } ) ; } ) ; } else { _ . each ( _ . keys ( cardPacks ) , function ( packKey ) { cardCount = cardCount + _ . keys ( cardPacks [ packKey ] . cards ) . length ; } ) ; } return cardCount ; } }
Get the number of cards matching an optional filter.

@method count
@param {String}    [filter]  Optional filter for card names. The filter will use fuzzy matching.

@returns {Number}  The number of cards found matching the filter.
Get the number of cards matching an optional filter .