学习?学个屁 06c63c15cc 初始化提交 10 mesiacov pred
..
.github 06c63c15cc 初始化提交 10 mesiacov pred
test 06c63c15cc 初始化提交 10 mesiacov pred
.eslintrc 06c63c15cc 初始化提交 10 mesiacov pred
.nycrc 06c63c15cc 初始化提交 10 mesiacov pred
CHANGELOG.md 06c63c15cc 初始化提交 10 mesiacov pred
LICENSE 06c63c15cc 初始化提交 10 mesiacov pred
README.md 06c63c15cc 初始化提交 10 mesiacov pred
index.d.mts 06c63c15cc 初始化提交 10 mesiacov pred
index.d.ts 06c63c15cc 初始化提交 10 mesiacov pred
index.js 06c63c15cc 初始化提交 10 mesiacov pred
index.mjs 06c63c15cc 初始化提交 10 mesiacov pred
legacy.js 06c63c15cc 初始化提交 10 mesiacov pred
package.json 06c63c15cc 初始化提交 10 mesiacov pred
require.mjs 06c63c15cc 初始化提交 10 mesiacov pred
tsconfig.json 06c63c15cc 初始化提交 10 mesiacov pred

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