|
пре 1 месец | |
---|---|---|
.. | ||
.github | пре 1 месец | |
test | пре 1 месец | |
.eslintrc | пре 1 месец | |
.nycrc | пре 1 месец | |
CHANGELOG.md | пре 1 месец | |
LICENSE | пре 1 месец | |
README.md | пре 1 месец | |
index.d.mts | пре 1 месец | |
index.d.ts | пре 1 месец | |
index.js | пре 1 месец | |
index.mjs | пре 1 месец | |
legacy.js | пре 1 месец | |
package.json | пре 1 месец | |
require.mjs | пре 1 месец | |
tsconfig.json | пре 1 месец |
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