Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p-any

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-any - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

60

index.d.ts

@@ -1,20 +0,50 @@

import PCancelable from 'p-cancelable';
import PCancelable = require('p-cancelable');
import {Omit} from 'type-fest';
import {Options as PSomeOptions} from 'p-some';
import {
Options as PSomeOptions,
AggregateError as PSomeAggregateError
} from 'p-some';
export type Value<ValueType> = ValueType | PromiseLike<ValueType>;
export type Options<ValueType> = Omit<PSomeOptions<ValueType>, 'count'>;
export type CancelablePromise<ValueType> = PCancelable<ValueType>;
declare namespace pAny {
type Value<ValueType> = ValueType | PromiseLike<ValueType>;
type Options<ValueType> = Omit<PSomeOptions<ValueType>, 'count'>;
type CancelablePromise<ValueType> = PCancelable<ValueType>;
type AggregateError = PSomeAggregateError;
}
/**
Wait for any promise to be fulfilled.
declare const pAny: {
/**
Wait for any promise to be fulfilled.
@param input - An `Iterable` collection of promises/values to wait for.
@returns A [cancelable `Promise`](https://github.com/sindresorhus/p-cancelable) that is fulfilled when any promise from `input` is fulfilled. If all the input promises reject, it will reject with an [`AggregateError`](https://github.com/sindresorhus/aggregate-error) error.
*/
export default function pAny<ValueType>(
input: Iterable<Value<ValueType>>,
options?: Options<ValueType>
): CancelablePromise<ValueType>;
@param input - An `Iterable` collection of promises/values to wait for.
@returns A [cancelable `Promise`](https://github.com/sindresorhus/p-cancelable) that is fulfilled when any promise from `input` is fulfilled. If all the input promises reject, it will reject with an [`AggregateError`](https://github.com/sindresorhus/aggregate-error) error.
export {default as AggregateError} from 'p-some';
@example
```
import got = require('got');
import pAny = require('p-any');
(async () => {
const first = await pAny([
got.head('https://github.com').then(() => 'github'),
got.head('https://google.com').then(() => 'google'),
got.head('https://twitter.com').then(() => 'twitter'),
]);
console.log(first);
//=> 'google'
})();
```
*/
<ValueType>(
input: Iterable<pAny.Value<ValueType>>,
options?: pAny.Options<ValueType>
): pAny.CancelablePromise<ValueType>;
AggregateError: typeof PSomeAggregateError;
// TODO: Remove this for the next major release
default: typeof pAny;
};
export = pAny;

@@ -19,4 +19,5 @@ 'use strict';

module.exports = pAny;
// TODO: Remove this for the next major release
module.exports.default = pAny;
module.exports.AggregateError = pSome.AggregateError;
{
"name": "p-any",
"version": "2.0.0",
"version": "2.1.0",
"description": "Wait for any promise to be fulfilled",

@@ -16,3 +16,3 @@ "license": "MIT",

"scripts": {
"test": "xo && ava && tsd-check"
"test": "xo && ava && tsd"
},

@@ -42,12 +42,12 @@ "files": [

"dependencies": {
"p-cancelable": "^1.1.0",
"p-cancelable": "^2.0.0",
"p-some": "^4.0.0",
"type-fest": "^0.1.0"
"type-fest": "^0.3.0"
},
"devDependencies": {
"ava": "^1.3.1",
"ava": "^1.4.1",
"delay": "^4.1.0",
"tsd-check": "^0.3.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc