Skip to content

Instantly share code, notes, and snippets.

@jasonbyrne
Created April 3, 2022 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonbyrne/8f1611e62a6cb96760074b62682c51f2 to your computer and use it in GitHub Desktop.
Save jasonbyrne/8f1611e62a6cb96760074b62682c51f2 to your computer and use it in GitHub Desktop.
Is this an async function?
export const isAsyncCallback = (func: Function): boolean => {
return (
func.constructor.name == 'AsyncFunction' ||
types.isAsyncFunction(func) ||
func.toString().indexOf('__awaiter(') > 0
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment