lib/collection/variable-scope.js
function (key, value, type) {
        var variable = this.values.oneNormalizedVariable(key),

            update = { // create an object that will be used as setter
                key: key,
                value: value
            };

        _.isString(type) && (update.type = type);

        // If a variable by the name key exists, update it's value and return.
        // @note adds new variable if existing is disabled. Disabled variables are not updated.
        if (variable && !variable.disabled) {
            variable.update(update);
        }
        else {
            this.values.add(update);
        }

        // track the change if mutation tracking is enabled
        this._postman_enableTracking && this.mutations.track(MUTATIONS.SET, key, value);
    }
function (key, value, type) {
        var variable = this.values.oneNormalizedVariable(key),

            update = { // create an object that will be used as setter
                key: key,
                value: value
            };

        _.isString(type) && (update.type = type);

        // If a variable by the name key exists, update it's value and return.
        // @note adds new variable if existing is disabled. Disabled variables are not updated.
        if (variable && !variable.disabled) {
            variable.update(update);
        }
        else {
            this.values.add(update);
        }

        // track the change if mutation tracking is enabled
        this._postman_enableTracking && this.mutations.track(MUTATIONS.SET, key, value);
    }
function ( key , value , type ) { var variable = this . values . oneNormalizedVariable ( key ) , update = { // create an object that will be used as setter key : key , value : value } ; _ . isString ( type ) && ( update . type = type ) ; // If a variable by the name key exists, update it's value and return. // @note adds new variable if existing is disabled. Disabled variables are not updated. if ( variable && ! variable . disabled ) { variable . update ( update ) ; } else { this . values . add ( update ) ; } // track the change if mutation tracking is enabled this . _postman_enableTracking && this . mutations . track ( MUTATIONS . SET , key , value ) ; }
Creates a new variable, or updates an existing one.

@param {String} key - The name of the variable to set.
@param {*} value - The value of the variable to be set.
@param {Variable.types} [type] - Optionally, the value of the variable can be set to a type
Creates a new variable or updates an existing one .