node_modules: update
This commit is contained in:
parent
4a21c51f2f
commit
b91baffed3
107 changed files with 3886 additions and 2943 deletions
65
node_modules/axios/lib/utils.js
generated
vendored
65
node_modules/axios/lib/utils.js
generated
vendored
|
@ -105,6 +105,21 @@ function isObject(val) {
|
|||
return val !== null && typeof val === 'object';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is a plain Object
|
||||
*
|
||||
* @param {Object} val The value to test
|
||||
* @return {boolean} True if value is a plain Object, otherwise false
|
||||
*/
|
||||
function isPlainObject(val) {
|
||||
if (toString.call(val) !== '[object Object]') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var prototype = Object.getPrototypeOf(val);
|
||||
return prototype === null || prototype === Object.prototype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a value is a Date
|
||||
*
|
||||
|
@ -261,34 +276,12 @@ function forEach(obj, fn) {
|
|||
function merge(/* obj1, obj2, obj3, ... */) {
|
||||
var result = {};
|
||||
function assignValue(val, key) {
|
||||
if (typeof result[key] === 'object' && typeof val === 'object') {
|
||||
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
||||
result[key] = merge(result[key], val);
|
||||
} else {
|
||||
result[key] = val;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||
forEach(arguments[i], assignValue);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function equal to merge with the difference being that no reference
|
||||
* to original objects is kept.
|
||||
*
|
||||
* @see merge
|
||||
* @param {Object} obj1 Object to merge
|
||||
* @returns {Object} Result of all merge properties
|
||||
*/
|
||||
function deepMerge(/* obj1, obj2, obj3, ... */) {
|
||||
var result = {};
|
||||
function assignValue(val, key) {
|
||||
if (typeof result[key] === 'object' && typeof val === 'object') {
|
||||
result[key] = deepMerge(result[key], val);
|
||||
} else if (typeof val === 'object') {
|
||||
result[key] = deepMerge({}, val);
|
||||
} else if (isPlainObject(val)) {
|
||||
result[key] = merge({}, val);
|
||||
} else if (isArray(val)) {
|
||||
result[key] = val.slice();
|
||||
} else {
|
||||
result[key] = val;
|
||||
}
|
||||
|
@ -319,6 +312,19 @@ function extend(a, b, thisArg) {
|
|||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
||||
*
|
||||
* @param {string} content with BOM
|
||||
* @return {string} content value without BOM
|
||||
*/
|
||||
function stripBOM(content) {
|
||||
if (content.charCodeAt(0) === 0xFEFF) {
|
||||
content = content.slice(1);
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isArray: isArray,
|
||||
isArrayBuffer: isArrayBuffer,
|
||||
|
@ -328,6 +334,7 @@ module.exports = {
|
|||
isString: isString,
|
||||
isNumber: isNumber,
|
||||
isObject: isObject,
|
||||
isPlainObject: isPlainObject,
|
||||
isUndefined: isUndefined,
|
||||
isDate: isDate,
|
||||
isFile: isFile,
|
||||
|
@ -338,7 +345,7 @@ module.exports = {
|
|||
isStandardBrowserEnv: isStandardBrowserEnv,
|
||||
forEach: forEach,
|
||||
merge: merge,
|
||||
deepMerge: deepMerge,
|
||||
extend: extend,
|
||||
trim: trim
|
||||
trim: trim,
|
||||
stripBOM: stripBOM
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue