htc 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
..
.github 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
test 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
.eslintrc 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
.nycrc 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
CHANGELOG.md 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
LICENSE 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
README.md 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
index.d.mts 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
index.d.ts 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
index.js 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
index.mjs 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
legacy.js 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
package.json 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
require.mjs 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前
tsconfig.json 7ca38fdcbb 善行少年PC端首次提交(基础版) 2 周之前

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