mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
Modifying isURLSearchParams function to use instanceof instead of duck typing
This commit is contained in:
+1
-9
@@ -149,15 +149,7 @@ function isStream(val) {
|
||||
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
||||
*/
|
||||
function isURLSearchParams(val) {
|
||||
// Object.prototype.toString will return [object Object] for a polyfill
|
||||
// Hence, we have to use duck typing
|
||||
return toString.call(val) === '[object URLSearchParams]' || (
|
||||
isObject(val) &&
|
||||
isFunction(val.append) &&
|
||||
isFunction(val.delete) &&
|
||||
isFunction(val.get) &&
|
||||
isFunction(val.set)
|
||||
);
|
||||
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user