🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

is-async-fn

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-async-fn

Check if something is an ES7 async function

1.1.0
latest
Source
npm
Version published
Weekly downloads
1.5K
13.1%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

function

FAQs

Package last updated on 29 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts