mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +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);
|
||||
}
|
||||
|
||||
const [isPlainFunction, isAsyncFn, isGeneratorFn, isAsyncGeneratorFn] = (
|
||||
(...fns) => fns.map(
|
||||
({constructor})=> (thing) => thing && typeof thing === 'function' && thing.constructor === constructor
|
||||
)
|
||||
)(()=> {}, async()=>{}, function*(){}, async function*(){});
|
||||
const isAsyncFn = kindOfTest('AsyncFunction');
|
||||
|
||||
const isThenable = (thing) =>
|
||||
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
||||
@@ -722,8 +718,5 @@ export default {
|
||||
isSpecCompliantForm,
|
||||
toJSONObject,
|
||||
isAsyncFn,
|
||||
isGeneratorFn,
|
||||
isAsyncGeneratorFn,
|
||||
isPlainFunction,
|
||||
isThenable
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user