is-async-fn

1.1.0 • Public • Published

is-async-fn

build status

Check if something is an ES7/ES2016 async/await function. i.e. It checks if the function was defined with the async keyword. It does NOT attempt to detect if the function is a traditional asynchronous function, one with a callback.

Compatible with code transformed with Babel 5 and Babel 6.

Install

npm i --save is-async-fn

Usage

isAsyncFn

Signature: isAsyncFn(function)

Parameters:

  • function: The function to check.

Returns: Type boolean. Returns true if the function was defined with the async keyword.

Example:

import isAsyncFn from 'is-async-fn'
 
console.log(isAsyncFn(function () {})) // => false
console.log(isAsyncFn(async function () {})) // => true

License

MIT

Copyright (c) JP Richardson

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    1,350
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    1,350
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i is-async-fn

Weekly Downloads

1,352

Version

1.1.0

License

MIT

Last publish

Collaborators

  • jprichardson