lib/collection/property-list.js
function (item) {
        // do not proceed on empty param, but empty strings are in fact valid.
        if (_.isNil(item) || _.isNaN(item)) { return null; }

        var indexer = this._postman_listIndexKey,
            existing = this.one(item[indexer]);

        if (existing) {
            if (!_.isFunction(existing.update)) {
                throw new Error('collection: unable to upsert into a list of Type that does not support .update()');
            }
            existing.update(item);
            return false;
        }

        // since there is no existing item, just add a new one
        this.add(item);
        return true; // indicate added
    }
function (item) {
        // do not proceed on empty param, but empty strings are in fact valid.
        if (_.isNil(item) || _.isNaN(item)) { return null; }

        var indexer = this._postman_listIndexKey,
            existing = this.one(item[indexer]);

        if (existing) {
            if (!_.isFunction(existing.update)) {
                throw new Error('collection: unable to upsert into a list of Type that does not support .update()');
            }
            existing.update(item);
            return false;
        }

        // since there is no existing item, just add a new one
        this.add(item);
        return true; // indicate added
    }
function ( item ) { // do not proceed on empty param, but empty strings are in fact valid. if ( _ . isNil ( item ) || _ . isNaN ( item ) ) { return null ; } var indexer = this . _postman_listIndexKey , existing = this . one ( item [ indexer ] ) ; if ( existing ) { if ( ! _ . isFunction ( existing . update ) ) { throw new Error ( 'collection: unable to upsert into a list of Type that does not support .update()' ) ; } existing . update ( item ) ; return false ; } // since there is no existing item, just add a new one this . add ( item ) ; return true ; // indicate added }
Add an item or update an existing item

@param {PropertyList~Type} item

@returns {?Boolean}
Add an item or update an existing item