|
пре 3 недеља | |
---|---|---|
.. | ||
.github | пре 3 недеља | |
test | пре 3 недеља | |
.eslintrc | пре 3 недеља | |
.nycrc | пре 3 недеља | |
CHANGELOG.md | пре 3 недеља | |
LICENSE | пре 3 недеља | |
README.md | пре 3 недеља | |
index.d.mts | пре 3 недеља | |
index.d.ts | пре 3 недеља | |
index.js | пре 3 недеља | |
index.mjs | пре 3 недеља | |
legacy.js | пре 3 недеља | |
package.json | пре 3 недеља | |
require.mjs | пре 3 недеља | |
tsconfig.json | пре 3 недеља |
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