Comparing version 2.0.0 to 2.1.0
@@ -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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5606
58
+ Addedtype-fest@0.3.1(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedtype-fest@0.1.0(transitive)
Updatedp-cancelable@^2.0.0
Updatedtype-fest@^0.3.0