GitHub 6248★

Check if a value is an async function

JavaScript version

const isAsyncFunction = (v) => Object.prototype.toString.call(v) === '[object AsyncFunction]';

Examples

isAsyncFunction(function () {}); // false
isAsyncFunction(function* () {}); // false
isAsyncFunction(async function () {}); // true
Follow me on and to get more useful contents.