async-function

1.0.0 • Public • Published

async-function Version Badge

github actions coverage License Downloads

npm badge

A function that returns the normally hidden AsyncFunction constructor, when available.

Getting started

npm install --save async-function

Usage/Examples

const assert = require('assert');
const AsyncFunction = require('async-function')();

const fn = new AsyncFunction('return 1');

assert.equal(fn.toString(), 'async function anonymous(\n) {\nreturn 1\n}');

fn().then(x => {
    assert.equal(x, 1);
});

Tests

Clone the repo, npm install, and run npm test

Package Sidebar

Install

npm i async-function

Weekly Downloads

12,935,664

Version

1.0.0

License

MIT

Unpacked Size

9.63 kB

Total Files

15

Last publish

Collaborators

  • ljharb
  • eduardorfs