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