max_liu b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
..
.github b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
test b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
.eslintrc b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
.nycrc b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
CHANGELOG.md b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
LICENSE b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
README.md b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
index.d.mts b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
index.d.ts b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
index.js b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
index.mjs b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
legacy.js b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
package.json b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
require.mjs b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen
tsconfig.json b7ab7c8514 chore: 更新node_modules依赖文件 vor 2 Wochen

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