mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40:40 +03:00
chore(utils): refactored isAsyncFn util to avoid inlining additional Babel helpers to the build; (#5684)
This commit is contained in:
+1
-8
@@ -662,11 +662,7 @@ const toJSONObject = (obj) => {
|
|||||||
return visit(obj, 0);
|
return visit(obj, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [isPlainFunction, isAsyncFn, isGeneratorFn, isAsyncGeneratorFn] = (
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
||||||
(...fns) => fns.map(
|
|
||||||
({constructor})=> (thing) => thing && typeof thing === 'function' && thing.constructor === constructor
|
|
||||||
)
|
|
||||||
)(()=> {}, async()=>{}, function*(){}, async function*(){});
|
|
||||||
|
|
||||||
const isThenable = (thing) =>
|
const isThenable = (thing) =>
|
||||||
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
||||||
@@ -722,8 +718,5 @@ export default {
|
|||||||
isSpecCompliantForm,
|
isSpecCompliantForm,
|
||||||
toJSONObject,
|
toJSONObject,
|
||||||
isAsyncFn,
|
isAsyncFn,
|
||||||
isGeneratorFn,
|
|
||||||
isAsyncGeneratorFn,
|
|
||||||
isPlainFunction,
|
|
||||||
isThenable
|
isThenable
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user