UNPKG

1.78 kBMarkdownView Raw
1# make-async-function <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![Build Status][travis-svg]][travis-url]
4[![dependency status][deps-svg]][deps-url]
5[![dev dependency status][dev-deps-svg]][dev-deps-url]
6[![License][license-image]][license-url]
7[![Downloads][downloads-image]][downloads-url]
8
9[![npm badge][npm-badge-png]][package-url]
10
11Function that returns an arbitrary `async function`, or undefined if `async function` syntax is unsupported.
12
13## Example
14```js
15var maybeAsyncFunction = require('make-async-function')();
16if (maybeAsyncFunction) {
17 assert(typeof maybeAsyncFunction === 'function');
18} else {
19 assert(typeof maybeAsyncFunction === 'undefined');
20}
21
22var asyncFunctions = require('make-async-function').list();
23assert(asyncFunctions.every(function (fn) { return typeof fn === 'function'; }));
24```
25
26## Tests
27Simply clone the repo, `npm install`, and run `npm test`
28
29[package-url]: https://npmjs.org/package/make-async-function
30[npm-version-svg]: http://versionbadg.es/ljharb/make-async-function.svg
31[travis-svg]: https://travis-ci.org/ljharb/make-async-function.svg
32[travis-url]: https://travis-ci.org/ljharb/make-async-function
33[deps-svg]: https://david-dm.org/ljharb/make-async-function.svg
34[deps-url]: https://david-dm.org/ljharb/make-async-function
35[dev-deps-svg]: https://david-dm.org/ljharb/make-async-function/dev-status.svg
36[dev-deps-url]: https://david-dm.org/ljharb/make-async-function#info=devDependencies
37[npm-badge-png]: https://nodei.co/npm/make-async-function.png?downloads=true&stars=true
38[license-image]: http://img.shields.io/npm/l/make-async-function.svg
39[license-url]: LICENSE
40[downloads-image]: http://img.shields.io/npm/dm/make-async-function.svg
41[downloads-url]: http://npm-stat.com/charts.html?package=make-async-function
42