Created
April 3, 2022 12:13
-
-
Save jasonbyrne/8f1611e62a6cb96760074b62682c51f2 to your computer and use it in GitHub Desktop.
Is this an async function?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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