2018-01-25 23:19:23 +00:00
|
|
|
var Extend = require('../utils/object/Extend');
|
2016-11-30 00:18:34 +00:00
|
|
|
var XHRSettings = require('./XHRSettings');
|
|
|
|
|
|
|
|
// Takes two XHR Objects and creates a new object
|
|
|
|
|
|
|
|
// The new object is based on global initially, but any setting in
|
|
|
|
// local overrides the global value.
|
|
|
|
|
|
|
|
var MergeXHRSettings = function (global, local)
|
|
|
|
{
|
2018-01-25 23:19:23 +00:00
|
|
|
var output = (global === undefined) ? XHRSettings() : Extend(global);
|
2016-11-30 00:18:34 +00:00
|
|
|
|
|
|
|
if (local)
|
|
|
|
{
|
|
|
|
for (var setting in local)
|
|
|
|
{
|
|
|
|
if (local[setting] !== undefined)
|
|
|
|
{
|
|
|
|
output[setting] = local[setting];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = MergeXHRSettings;
|