2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Moving Axios class into core/

This commit is contained in:
Matt Zabriskie
2016-06-01 14:42:14 -06:00
parent 203cbc2da0
commit 0e2f4f1417
4 changed files with 173 additions and 101 deletions
+22
View File
@@ -1,5 +1,7 @@
'use strict';
var bind = require('./helpers/bind');
/*global toString:true*/
// utils is a library of generic helper functions non-specific to axios
@@ -255,6 +257,25 @@ function merge(/* obj1, obj2, obj3, ... */) {
return result;
}
/**
* Extends object a by mutably adding to it the properties of object b.
*
* @param {Object} a The object to be extended
* @param {Object} b The object to copy properties from
* @param {Object} thisArg The object to bind function to
* @return {Object} The resulting value of object a
*/
function extend(a, b, thisArg) {
forEach(b, function assignValue(val, key) {
if (thisArg && typeof val === 'function') {
a[key] = bind(val, thisArg);
} else {
a[key] = val;
}
});
return a;
}
module.exports = {
isArray: isArray,
isArrayBuffer: isArrayBuffer,
@@ -273,5 +294,6 @@ module.exports = {
isStandardBrowserEnv: isStandardBrowserEnv,
forEach: forEach,
merge: merge,
extend: extend,
trim: trim
};