zlwu dd667101ef first commit před 1 rokem
..
.github dd667101ef first commit před 1 rokem
test dd667101ef first commit před 1 rokem
.eslintrc dd667101ef first commit před 1 rokem
.nycrc dd667101ef first commit před 1 rokem
CHANGELOG.md dd667101ef first commit před 1 rokem
LICENSE dd667101ef first commit před 1 rokem
README.md dd667101ef first commit před 1 rokem
index.d.mts dd667101ef first commit před 1 rokem
index.d.ts dd667101ef first commit před 1 rokem
index.js dd667101ef first commit před 1 rokem
index.mjs dd667101ef first commit před 1 rokem
legacy.js dd667101ef first commit před 1 rokem
package.json dd667101ef first commit před 1 rokem
require.mjs dd667101ef first commit před 1 rokem
tsconfig.json dd667101ef first commit před 1 rokem

README.md

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