2
0
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:
Dmitriy Mozgovoy
2023-04-28 01:44:23 +03:00
committed by GitHub
parent e18fdd893d
commit d627610d0c
+1 -8
View File
@@ -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
};