is-async-fn
Check if something is an ES7 async function
Last updated 9 years ago by jprichardson .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install is-async-fn 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.0                                ...           latest (9 years ago)

3 Versions

  • 1.1.0                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (9)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |