Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-async-func

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-async-func

Check if a value is an async function, from ES2017 specification. Supports babel.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

is-async-func

size dependencies NPM Travis Codecov

Check if a value is an async function, from ES2017 specification

Supports runtime implementations, as well as babel transpiled code.

const isAsyncFunction = require('is-async-func');

isAsyncFunction(async function () {})
// true

isAsyncFunction(async function foo () {})
// true

isAsyncFunction(async () => {})
// true

const foo = { async bar () {} }
isAsyncFunction(foo.bar)
// true

const foo = { bar: async function () {} }
isAsyncFunction(foo.bar)
// true

const foo = { bar: async () => {} }
isAsyncFunction(foo.bar)
// true

class Foo () {
  async bar () {}
}
isAsyncFunction((new Foo()).bar)
// true

Install

npm install is-async-func
# yarn add is-async-func

Should I use this?

For runtimes that support async/await, yes!

For transpiled async/await, probably! :grimacing:
The transpilation tests cover many different combinations of async declarations and babel transform presets, but the transpiled detection generally takes a hacky approach. Probably-definitely don't use this in hot code.

License

Licensed under the MIT License, Copyright © 2017 Lochlan Bunn.

FAQs

Package last updated on 02 Apr 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc