2
0
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:
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); 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
}; };