lib/collection/property-list.js
function (source, prune) {
        var members = PropertyList.isPropertyList(source) ? source.members : source,
            list = this,
            indexer = list._postman_listIndexKey,
            sourceKeys = {}; // keeps track of added / updated keys for later exclusion

        if (!_.isArray(members)) {
            return;
        }

        members.forEach(function (item) {
            if (!(item && item.hasOwnProperty(indexer))) { return; }
            list.upsert(item);
            sourceKeys[item[indexer]] = true;
        });

        // now remove any variable that is not in source object
        // @note - using direct `this.reference` list of keys here so that we can mutate the list while iterating
        // on it
        if (prune) {
            _.forEach(list.reference, function (value, key) {
                if (sourceKeys.hasOwnProperty(key)) { return; } // de not delete if source obj has this variable
                list.remove(key); // use PropertyList functions to remove so that the .members array is cleared too
            });
        }
    }
function (source, prune) {
        var members = PropertyList.isPropertyList(source) ? source.members : source,
            list = this,
            indexer = list._postman_listIndexKey,
            sourceKeys = {}; // keeps track of added / updated keys for later exclusion

        if (!_.isArray(members)) {
            return;
        }

        members.forEach(function (item) {
            if (!(item && item.hasOwnProperty(indexer))) { return; }
            list.upsert(item);
            sourceKeys[item[indexer]] = true;
        });

        // now remove any variable that is not in source object
        // @note - using direct `this.reference` list of keys here so that we can mutate the list while iterating
        // on it
        if (prune) {
            _.forEach(list.reference, function (value, key) {
                if (sourceKeys.hasOwnProperty(key)) { return; } // de not delete if source obj has this variable
                list.remove(key); // use PropertyList functions to remove so that the .members array is cleared too
            });
        }
    }
function ( source , prune ) { var members = PropertyList . isPropertyList ( source ) ? source . members : source , list = this , indexer = list . _postman_listIndexKey , sourceKeys = { } ; // keeps track of added / updated keys for later exclusion if ( ! _ . isArray ( members ) ) { return ; } members . forEach ( function ( item ) { if ( ! ( item && item . hasOwnProperty ( indexer ) ) ) { return ; } list . upsert ( item ) ; sourceKeys [ item [ indexer ] ] = true ; } ) ; // now remove any variable that is not in source object // @note - using direct `this.reference` list of keys here so that we can mutate the list while iterating // on it if ( prune ) { _ . forEach ( list . reference , function ( value , key ) { if ( sourceKeys . hasOwnProperty ( key ) ) { return ; } // de not delete if source obj has this variable list . remove ( key ) ; // use PropertyList functions to remove so that the .members array is cleared too } ) ; } }
Add or update values from a source list.

@param {PropertyList|Array} source
@param {Boolean} [prune=false] Setting this to `true` will cause the extra items from the list to be deleted
Add or update values from a source list .