lib/collection/property-list.js
function (predicate, context) {
        var match; // to be used if predicate is an ID

        !context && (context = this);

        if (_.isString(predicate)) {
            // if predicate is id, then create a function to remove that
            // need to take care of case sensitivity as well :/
            match = this._postman_listIndexCaseInsensitive ? predicate.toLowerCase() : predicate;
            predicate = function (item) {
                var id = item[this._postman_listIndexKey];
                this._postman_listIndexCaseInsensitive && (id = id.toLowerCase());
                return id === match;
            }.bind(this);
        }
        else if (predicate instanceof this.Type) {
            // in case an object reference is sent, prepare it for removal using direct reference comparison
            match = predicate;
            predicate = function (item) {
                return (item === match);
            };
        }

        _.isFunction(predicate) && _.remove(this.members, function (item) {
            var index;
            if (predicate.apply(context, arguments)) {
                if ((index = item[this._postman_listIndexKey]) && (index = String(index))) {
                    this._postman_listIndexCaseInsensitive && (index = index.toLowerCase());

                    if (this._postman_listAllowsMultipleValues && _.isArray(this.reference[index])) {
                        // since we have an array of multiple values, remove only the value for which the
                        // predicate returned truthy. If the array becomes empty, just delete it.
                        _.remove(this.reference[index], function (each) {
                            return each === item;
                        });

                        // If the array becomes empty, remove it
                        (this.reference[index].length === 0) && (delete this.reference[index]);

                        // If the array contains only one element, remove the array, and assign the element
                        // as the reference value
                        (this.reference[index].length === 1) && (this.reference[index] = this.reference[index][0]);
                    }
                    else {
                        delete this.reference[index];
                    }
                }
                delete item[__PARENT]; // unlink from its parent
                return true;
            }
        }.bind(this));
    }
function (predicate, context) {
        var match; // to be used if predicate is an ID

        !context && (context = this);

        if (_.isString(predicate)) {
            // if predicate is id, then create a function to remove that
            // need to take care of case sensitivity as well :/
            match = this._postman_listIndexCaseInsensitive ? predicate.toLowerCase() : predicate;
            predicate = function (item) {
                var id = item[this._postman_listIndexKey];
                this._postman_listIndexCaseInsensitive && (id = id.toLowerCase());
                return id === match;
            }.bind(this);
        }
        else if (predicate instanceof this.Type) {
            // in case an object reference is sent, prepare it for removal using direct reference comparison
            match = predicate;
            predicate = function (item) {
                return (item === match);
            };
        }

        _.isFunction(predicate) && _.remove(this.members, function (item) {
            var index;
            if (predicate.apply(context, arguments)) {
                if ((index = item[this._postman_listIndexKey]) && (index = String(index))) {
                    this._postman_listIndexCaseInsensitive && (index = index.toLowerCase());

                    if (this._postman_listAllowsMultipleValues && _.isArray(this.reference[index])) {
                        // since we have an array of multiple values, remove only the value for which the
                        // predicate returned truthy. If the array becomes empty, just delete it.
                        _.remove(this.reference[index], function (each) {
                            return each === item;
                        });

                        // If the array becomes empty, remove it
                        (this.reference[index].length === 0) && (delete this.reference[index]);

                        // If the array contains only one element, remove the array, and assign the element
                        // as the reference value
                        (this.reference[index].length === 1) && (this.reference[index] = this.reference[index][0]);
                    }
                    else {
                        delete this.reference[index];
                    }
                }
                delete item[__PARENT]; // unlink from its parent
                return true;
            }
        }.bind(this));
    }
function ( predicate , context ) { var match ; // to be used if predicate is an ID ! context && ( context = this ) ; if ( _ . isString ( predicate ) ) { // if predicate is id, then create a function to remove that // need to take care of case sensitivity as well :/ match = this . _postman_listIndexCaseInsensitive ? predicate . toLowerCase ( ) : predicate ; predicate = function ( item ) { var id = item [ this . _postman_listIndexKey ] ; this . _postman_listIndexCaseInsensitive && ( id = id . toLowerCase ( ) ) ; return id === match ; } . bind ( this ) ; } else if ( predicate instanceof this . Type ) { // in case an object reference is sent, prepare it for removal using direct reference comparison match = predicate ; predicate = function ( item ) { return ( item === match ) ; } ; } _ . isFunction ( predicate ) && _ . remove ( this . members , function ( item ) { var index ; if ( predicate . apply ( context , arguments ) ) { if ( ( index = item [ this . _postman_listIndexKey ] ) && ( index = String ( index ) ) ) { this . _postman_listIndexCaseInsensitive && ( index = index . toLowerCase ( ) ) ; if ( this . _postman_listAllowsMultipleValues && _ . isArray ( this . reference [ index ] ) ) { // since we have an array of multiple values, remove only the value for which the // predicate returned truthy. If the array becomes empty, just delete it. _ . remove ( this . reference [ index ] , function ( each ) { return each === item ; } ) ; // If the array becomes empty, remove it ( this . reference [ index ] . length === 0 ) && ( delete this . reference [ index ] ) ; // If the array contains only one element, remove the array, and assign the element // as the reference value ( this . reference [ index ] . length === 1 ) && ( this . reference [ index ] = this . reference [ index ] [ 0 ] ) ; } else { delete this . reference [ index ] ; } } delete item [ __PARENT ] ; // unlink from its parent return true ; } } . bind ( this ) ) ; }
Removes all elements from the PropertyList for which the predicate returns truthy.

@param {Function|String|Type} predicate
@param {Object} context Optional context to bind the predicate to.
Removes all elements from the PropertyList for which the predicate returns truthy .