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

Remove 'includes' API, fix CI build failure (#2574)

* Remove 'includes' API, fix CI build failure
This commit is contained in:
Alanscut
2019-12-09 10:28:37 +08:00
committed by GitHub
parent fa6cf01c91
commit 13c948e661
+11 -11
View File
@@ -18,6 +18,15 @@ function isArray(val) {
return toString.call(val) === '[object Array]';
}
/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}
/**
* Determine if a value is a Buffer
@@ -26,7 +35,8 @@ function isArray(val) {
* @returns {boolean} True if value is a Buffer, otherwise false
*/
function isBuffer(val) {
return ![undefined, null].includes(val) && val.constructor === Buffer;
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
&& typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
}
/**
@@ -85,16 +95,6 @@ function isNumber(val) {
return typeof val === 'number';
}
/**
* Determine if a value is undefined
*
* @param {Object} val The value to test
* @returns {boolean} True if the value is undefined, otherwise false
*/
function isUndefined(val) {
return typeof val === 'undefined';
}
/**
* Determine if a value is an Object
*