Skip to content

Commit

Permalink
chore(utils): refactored isAsyncFn util to avoid inlining additional …
Browse files Browse the repository at this point in the history
…Babel helpers to the build; (axios#5684)
  • Loading branch information
DigitalBrainJS authored and Willian Agostini committed May 29, 2023
1 parent ff5ca0a commit 9d1b599
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/utils.js
Expand Up @@ -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);
Expand Down Expand Up @@ -722,8 +718,5 @@ export default {
isSpecCompliantForm,
toJSONObject,
isAsyncFn,
isGeneratorFn,
isAsyncGeneratorFn,
isPlainFunction,
isThenable
};

0 comments on commit 9d1b599

Please sign in to comment.