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