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