src/filter-collection.js
function() {
    var self = this;
    self.newFilterCount += 1;

    if (self.length === 0) {
      return self.newFilterCount;
    }
    else {
      var newFilterName = self.newFilterName.replace(self.filterNamePartial, "");
      var results = self.filter(function(fm) {
        return fm.get("name").indexOf(newFilterName) === 0;
      }).map(function(fm) {
        return fm.get("name");
      });

      if (_.isArray(results) && results.length > 0) {
        // Sort results
        results.sort();

        // Get highest count
        var highestCount = parseInt(results[results.length - 1].replace(newFilterName, ""));
        if (_.isNaN(highestCount)) {
          highestCount = self.newFilterCount;
        }
        else {
          highestCount += 1;
        }
      }
      else {
        highestCount = self.newFilterCount;
      }

      return highestCount;
    }
  }
function() {
    var self = this;
    self.newFilterCount += 1;

    if (self.length === 0) {
      return self.newFilterCount;
    }
    else {
      var newFilterName = self.newFilterName.replace(self.filterNamePartial, "");
      var results = self.filter(function(fm) {
        return fm.get("name").indexOf(newFilterName) === 0;
      }).map(function(fm) {
        return fm.get("name");
      });

      if (_.isArray(results) && results.length > 0) {
        // Sort results
        results.sort();

        // Get highest count
        var highestCount = parseInt(results[results.length - 1].replace(newFilterName, ""));
        if (_.isNaN(highestCount)) {
          highestCount = self.newFilterCount;
        }
        else {
          highestCount += 1;
        }
      }
      else {
        highestCount = self.newFilterCount;
      }

      return highestCount;
    }
  }
function ( ) { var self = this ; self . newFilterCount += 1 ; if ( self . length === 0 ) { return self . newFilterCount ; } else { var newFilterName = self . newFilterName . replace ( self . filterNamePartial , "" ) ; var results = self . filter ( function ( fm ) { return fm . get ( "name" ) . indexOf ( newFilterName ) === 0 ; } ) . map ( function ( fm ) { return fm . get ( "name" ) ; } ) ; if ( _ . isArray ( results ) && results . length > 0 ) { // Sort results results . sort ( ) ; // Get highest count var highestCount = parseInt ( results [ results . length - 1 ] . replace ( newFilterName , "" ) ) ; if ( _ . isNaN ( highestCount ) ) { highestCount = self . newFilterCount ; } else { highestCount += 1 ; } } else { highestCount = self . newFilterCount ; } return highestCount ; } }
Retrieves a new filter number.
@method getNewFilterNumber
@return {int}
@private
Retrieves a new filter number .