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