ampersand-filtered-subcollection.js
function (model, options, eventName) {
        var newModels = slice.call(this.models);
        var comparator = this.comparator || this.collection.comparator;
        //Whether or not we are to expect a sort event from our collection later
        var sortable = eventName === 'add' && this.collection.comparator && (options.at == null) && options.sort !== false;
        if (!sortable) {
            var index = sortedIndexBy(newModels, model, comparator);
            newModels.splice(index, 0, model);
        } else {
            newModels.push(model);
            if (options.at) newModels = this._sortModels(newModels);
        }

        this.models = newModels;
        this._addIndex(this._indexes, model);
        if (this.comparator && !sortable) {
            this.trigger('sort', this);
        }
    }
function (model, options, eventName) {
        var newModels = slice.call(this.models);
        var comparator = this.comparator || this.collection.comparator;
        //Whether or not we are to expect a sort event from our collection later
        var sortable = eventName === 'add' && this.collection.comparator && (options.at == null) && options.sort !== false;
        if (!sortable) {
            var index = sortedIndexBy(newModels, model, comparator);
            newModels.splice(index, 0, model);
        } else {
            newModels.push(model);
            if (options.at) newModels = this._sortModels(newModels);
        }

        this.models = newModels;
        this._addIndex(this._indexes, model);
        if (this.comparator && !sortable) {
            this.trigger('sort', this);
        }
    }
function ( model , options , eventName ) { var newModels = slice . call ( this . models ) ; var comparator = this . comparator || this . collection . comparator ; //Whether or not we are to expect a sort event from our collection later var sortable = eventName === 'add' && this . collection . comparator && ( options . at == null ) && options . sort !== false ; if ( ! sortable ) { var index = sortedIndexBy ( newModels , model , comparator ) ; newModels . splice ( index , 0 , model ) ; } else { newModels . push ( model ) ; if ( options . at ) newModels = this . _sortModels ( newModels ) ; } this . models = newModels ; this . _addIndex ( this . _indexes , model ) ; if ( this . comparator && ! sortable ) { this . trigger ( 'sort' , this ) ; } }
Add a model to this filtered collection that has already passed the filters
Add a model to this filtered collection that has already passed the filters