Determine if a function is a native async function.
- Types
- ESM
- CJS
- License
- MIT
- Install Size
- 23.3 kB(348.8 kB)
- Vulns
- 0
- Published
$
npm install is-async-function$
pnpm add is-async-function$
yarn add is-async-function$
bun add is-async-function$
deno add npm:is-async-function$
vlt install is-async-function$
vp add is-async-functionYou might not need this dependency.
You can use typeof and Object.prototype.toString.call to check if it's an async function
Example:
const isAsyncFunction = (obj) => typeof obj === "function" && Object.prototype.toString.call(obj) === "[object AsyncFunction]"is-async-function 
Is this a native async function?
Example
var isAsyncFunction = require('is-async-function');
assert(!isAsyncFunction(function () {}));
assert(!isAsyncFunction(null));
assert(!isAsyncFunction(function* () { yield 42; return Infinity; }));
assert(isAsyncFunction(async function () {}));
Tests
Simply clone the repo, npm install, and run npm test
