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