Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
p-some
Advanced tools
Readme
Wait for a specified number of promises to be fulfilled
Useful when you need the fastest of multiple promises.
$ npm install p-some
Checks 4 websites and logs the 2 fastest.
import got from 'got';
import pSome from 'p-some';
const input = [
got.head('github.com').then(() => 'github'),
got.head('google.com').then(() => 'google'),
got.head('twitter.com').then(() => 'twitter'),
got.head('medium.com').then(() => 'medium')
];
const [first, second] = await pSome(input, {count: 2});
console.log(first, second);
//=> 'google twitter'
Returns a cancelable Promise
that is fulfilled when count
promises from input
are fulfilled. The fulfilled value is an Array
of the values from the input
promises in the order they were fulfilled. If it becomes impossible to satisfy count
, for example, too many promises rejected, it will reject with an AggregateError
error.
If you pass in cancelable promises, specifically promises with a .cancel()
method, that method will be called for the promises that are still unfulfilled when the returned Promise
is either fulfilled or rejected.
Type: Iterable<Promise | unknown>
An Iterable
collection of promises/values to wait for.
Type: object
Required
Type: number
Minimum: 1
Number of promises from input
that have to be fulfilled until the returned promise is fulfilled.
Type: Function
Receives the value resolved by the promise. Used to filter out values that doesn't satisfy a condition.
Exposed for instance checking.
Exposed for instance checking.
FAQs
Wait for a specified number of promises to be fulfilled
The npm package p-some receives a total of 432,498 weekly downloads. As such, p-some popularity was classified as popular.
We found that p-some 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.