![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@supercharge/promise-pool
Advanced tools
Changelog
1.0.0 - 2019-07-15
1.0.0
release 🚀 🎉Readme
Map-like, concurrent promise processing for Node.js.
Installation · Usage · API
Follow @marcuspoehls and @superchargejs for updates!
npm i @supercharge/promise-pool
Using the promise pool is pretty straightforward. The pacakge exposes a class and you can create a promise pool instance using the fluent interface. Here’s a working example:
const PromisePool = require('@supercharge/promise-pool')
const users = [
{ name: 'Marcus' },
{ name: 'Norman' },
{ name: 'Christian' }
]
const { results, errors } = await new PromisePool()
.for(users)
.withConcurrency(2)
.process(async user => {
const user = await User.createIfNotExisting(user)
return user
})
new PromisePool({ concurrency?, items? })
constructorCreates a new promise pool. The constructor takes an optional options
object allowing you to passing in the concurrency
and items
.
const pool = new PromisePool({ concurrency: 2, items: [1, 2, 3] })
.withConcurrency(amount)
Set the maximum number of functions to process in parallel. Default concurrency: 10
. Returns the promise pool instance.
const pool = new PromisePool().withConcurrency(5)
.for(items)
Set the items to be processed in the promise pool. Returns the promise pool instance.
const users = [
{ name: 'Marcus' },
{ name: 'Norman' },
{ name: 'Christian' }
]
const pool = new PromisePool().withConcurrency(5).for(users)
.process(callback)
Starts processing the promise pool by iterating over the items and passing each item to the async mapper function. Returns an object containing the results and errors.
const users = [
{ name: 'Marcus' },
{ name: 'Norman' },
{ name: 'Christian' }
]
const pool = new PromisePool().withConcurrency(5).for(users)
const { results, errors } = await pool.process(async (user) => {
await User.createIfNotExisting(user)
})
git checkout -b my-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © Supercharge
superchargejs.com · GitHub @superchargejs · Twitter @superchargejs
FAQs
Map-like, concurrent promise processing for Node.js
The npm package @supercharge/promise-pool receives a total of 367,469 weekly downloads. As such, @supercharge/promise-pool popularity was classified as popular.
We found that @supercharge/promise-pool demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.