lib/collection/variable-list.js
function (obj, track, prune) {
        var list = this,
            ops = track && {
                created: [],
                updated: [],
                deleted: []
            },
            indexer = list._postman_listIndexKey,
            tmp;

        if (!_.isObject(obj)) { return ops; }

        // ensure that all properties in the object is updated in this list
        _.forOwn(obj, function (value, key) {
            // we need to create new variable if exists or update existing
            if (list.has(key)) {
                list.one(key).set(value);
                ops && ops.updated.push(key);
            }
            else {
                tmp = { value: value };
                tmp[indexer] = key;
                list.add(tmp);
                tmp = null;
                ops && ops.created.push(key);
            }
        });

        // 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 !== false) {
            _.forEach(list.reference, function (value, key) {
                if (obj.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
                ops && ops.deleted.push(key);
            });
        }

        return ops;
    }
function (obj, track, prune) {
        var list = this,
            ops = track && {
                created: [],
                updated: [],
                deleted: []
            },
            indexer = list._postman_listIndexKey,
            tmp;

        if (!_.isObject(obj)) { return ops; }

        // ensure that all properties in the object is updated in this list
        _.forOwn(obj, function (value, key) {
            // we need to create new variable if exists or update existing
            if (list.has(key)) {
                list.one(key).set(value);
                ops && ops.updated.push(key);
            }
            else {
                tmp = { value: value };
                tmp[indexer] = key;
                list.add(tmp);
                tmp = null;
                ops && ops.created.push(key);
            }
        });

        // 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 !== false) {
            _.forEach(list.reference, function (value, key) {
                if (obj.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
                ops && ops.deleted.push(key);
            });
        }

        return ops;
    }
function ( obj , track , prune ) { var list = this , ops = track && { created : [ ] , updated : [ ] , deleted : [ ] } , indexer = list . _postman_listIndexKey , tmp ; if ( ! _ . isObject ( obj ) ) { return ops ; } // ensure that all properties in the object is updated in this list _ . forOwn ( obj , function ( value , key ) { // we need to create new variable if exists or update existing if ( list . has ( key ) ) { list . one ( key ) . set ( value ) ; ops && ops . updated . push ( key ) ; } else { tmp = { value : value } ; tmp [ indexer ] = key ; list . add ( tmp ) ; tmp = null ; ops && ops . created . push ( key ) ; } } ) ; // 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 !== false ) { _ . forEach ( list . reference , function ( value , key ) { if ( obj . 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 ops && ops . deleted . push ( key ) ; } ) ; } return ops ; }
Using this function, one can sync the values of this variable list from a reference object.

@param {Object} obj
@param {Boolean=} track
@param {Boolean} [prune=true]

@returns {Object}
Using this function one can sync the values of this variable list from a reference object .