src/collection/collection.js
function(model, at){
        model = new this._Model(model, this.options.Model.options);

        if (!this.hasModel(model)) {
            // Attach events to the model that will signal collection events
            this.attachModelEvents(model);

            // If _models is empty, then we make sure to push instead of splice.
            at = this.length == 0 ? void 0 : at;

            if (at != void 0) {
                this._models.splice(at, 0, model);
            } else {
                this._models.push(model);
            }

            this.length = this._models.length;

            this._changed = true;

            // if at is undefined, then it would be at the end of the array, thus this.length-1
            this.signalAdd(model, at != void 0 ? at : this.length - 1);
        }

        return this;
    }
function(model, at){
        model = new this._Model(model, this.options.Model.options);

        if (!this.hasModel(model)) {
            // Attach events to the model that will signal collection events
            this.attachModelEvents(model);

            // If _models is empty, then we make sure to push instead of splice.
            at = this.length == 0 ? void 0 : at;

            if (at != void 0) {
                this._models.splice(at, 0, model);
            } else {
                this._models.push(model);
            }

            this.length = this._models.length;

            this._changed = true;

            // if at is undefined, then it would be at the end of the array, thus this.length-1
            this.signalAdd(model, at != void 0 ? at : this.length - 1);
        }

        return this;
    }
function ( model , at ) { model = new this . _Model ( model , this . options . Model . options ) ; if ( ! this . hasModel ( model ) ) { // Attach events to the model that will signal collection events this . attachModelEvents ( model ) ; // If _models is empty, then we make sure to push instead of splice. at = this . length == 0 ? void 0 : at ; if ( at != void 0 ) { this . _models . splice ( at , 0 , model ) ; } else { this . _models . push ( model ) ; } this . length = this . _models . length ; this . _changed = true ; // if at is undefined, then it would be at the end of the array, thus this.length-1 this . signalAdd ( model , at != void 0 ? at : this . length - 1 ) ; } return this ; }
Private add method
@param  {Class} model A Model instance
@param {Number} at The index at which the model should be inserted
@return {Class} Collection Instance
Private add method