Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
auto-promise2
Advanced tools
A module for getting [caolan-style](https://caolan.github.io/async/v3/docs.html#auto) "async.auto" type functionality but for Promise-style async functions.
A module for getting caolan-style "async.auto" type functionality but for Promise-style async functions.
Not yet necessarily stable (still need to add support for concurrency limit), but seems to work so far. Had fun writing it as a meditative challenge, may tighten it up recreationally.
Basically the same design goal as promise-auto
, auto-promise
, or promise-auto2
, except using native language Promises, so it's a bit more modern in style. Also written in TypeScript. Honestly we all probably did it because writing this module is fun.
This module is maintained in the style of the MetaMask team.
It uses:
auto-promise2
is made available as either a CommonJS module, and ES6 module, or an ES5 bundle.
import auto from 'auto-promise2'
const auto = require('auto-promise2')
dist/auto-promise2.js
(this can be included directly in a page)You pass auto()
an object where keys are different tasks, and each task is an array where the last item is an async function to perform, and any preceding entries are string names of other tasks that must be completed first.
Each task is then passed a needs
object that includes keyed results for all previously completed tasks, and the entire auto()
function returns a promise for an object with all the completed values keyed on their task names.
Makes it easy to write complex weaving conditional logic for many tasks to run concurrently.
const result = await auto({
a: [async () => 'a'],
b: [async () => 'b'],
c: ['a', async (needs) => needs.a ? 'c' : 'no'],
d: ['a', 'b', async (needs) => needs.a && needs.b ? 'd' : 'no'],
e: ['c', 'd', async (needs) => needs.c && needs.d ? 'e' : 'no'],
});
expect(result.e).toEqual('e');
Run yarn test
to run the tests once.
To run tests on file changes, run yarn test:watch
.
main
1.x
)yarn version --minor --no-git-tag-version
)FAQs
A module for getting [caolan-style](https://caolan.github.io/async/v3/docs.html#auto) "async.auto" type functionality but for Promise-style async functions.
The npm package auto-promise2 receives a total of 1 weekly downloads. As such, auto-promise2 popularity was classified as not popular.
We found that auto-promise2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.