code: function replaceVars(value, vars) {
          if (typeof value != "string") {
            value = value(vars);
          } else if (vars) {
            value = value.replace(/%(\w+)/g, function (str, name) {
              return vars[name] || str;
            });
          }
  
          return value;
        }
docs: Replaces variables in the value. The variable format is %var.
  
  @private
  @param {String} value Value to replace variables in.
  @param {Object} vars Name/value array with variables to replace.
  @return {String} New value with replaced variables.