|
|
преди 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