|
|
hai 2 semanas | |
|---|---|---|
| .. | ||
| .github | hai 2 semanas | |
| test | hai 2 semanas | |
| .eslintrc | hai 2 semanas | |
| .nycrc | hai 2 semanas | |
| CHANGELOG.md | hai 2 semanas | |
| LICENSE | hai 2 semanas | |
| README.md | hai 2 semanas | |
| index.d.mts | hai 2 semanas | |
| index.d.ts | hai 2 semanas | |
| index.js | hai 2 semanas | |
| index.mjs | hai 2 semanas | |
| legacy.js | hai 2 semanas | |
| package.json | hai 2 semanas | |
| require.mjs | hai 2 semanas | |
| tsconfig.json | hai 2 semanas | |
A function that returns the normally hidden AsyncFunction constructor, when available.
npm install --save async-function
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);
});
Clone the repo, npm install, and run npm test