|
|
hace 2 semanas | |
|---|---|---|
| .. | ||
| .github | hace 2 semanas | |
| test | hace 2 semanas | |
| .eslintrc | hace 2 semanas | |
| .nycrc | hace 2 semanas | |
| CHANGELOG.md | hace 2 semanas | |
| LICENSE | hace 2 semanas | |
| README.md | hace 2 semanas | |
| index.d.mts | hace 2 semanas | |
| index.d.ts | hace 2 semanas | |
| index.js | hace 2 semanas | |
| index.mjs | hace 2 semanas | |
| legacy.js | hace 2 semanas | |
| package.json | hace 2 semanas | |
| require.mjs | hace 2 semanas | |
| tsconfig.json | hace 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