Socket
Socket
Sign inDemoInstall

cancelable-promise

Package Overview
Dependencies
0
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.1 to 4.3.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [4.3.0](https://github.com/alkemics/CancelablePromise/releases/tag/v4.3.0) (2022-03-14)
- chore(deps-dev): bump @typescript-eslint/eslint-plugin
- chore(deps-dev): bump @typescript-eslint/parser from 5.13.0 to 5.14.0
- chore(deps-dev): bump lint-staged from 12.3.4 to 12.3.5
- feat(any): support Promise.any
## [4.2.1](https://github.com/alkemics/CancelablePromise/releases/tag/v4.2.1) (2021-07-09)

@@ -2,0 +9,0 @@

25

esm/CancelablePromise.d.ts

@@ -15,21 +15,12 @@ declare class CancelablePromiseInternal<T = any> {

export declare class CancelablePromise<T = any> extends CancelablePromiseInternal<T> {
static all: {
<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>, T11 | PromiseLike<T11>, T12 | PromiseLike<T12>]): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]>;
<T1_1, T2_1, T3_1, T4_1, T5_1, T6_1, T7_1, T8_1, T9_1, T10_1, T11_1>(values: readonly [T1_1 | PromiseLike<T1_1>, T2_1 | PromiseLike<T2_1>, T3_1 | PromiseLike<T3_1>, T4_1 | PromiseLike<T4_1>, T5_1 | PromiseLike<T5_1>, T6_1 | PromiseLike<T6_1>, T7_1 | PromiseLike<T7_1>, T8_1 | PromiseLike<T8_1>, T9_1 | PromiseLike<T9_1>, T10_1 | PromiseLike<T10_1>, T11_1 | PromiseLike<T11_1>]): CancelablePromise<[T1_1, T2_1, T3_1, T4_1, T5_1, T6_1, T7_1, T8_1, T9_1, T10_1, T11_1]>;
<T1_2, T2_2, T3_2, T4_2, T5_2, T6_2, T7_2, T8_2, T9_2, T10_2>(values: readonly [T1_2 | PromiseLike<T1_2>, T2_2 | PromiseLike<T2_2>, T3_2 | PromiseLike<T3_2>, T4_2 | PromiseLike<T4_2>, T5_2 | PromiseLike<T5_2>, T6_2 | PromiseLike<T6_2>, T7_2 | PromiseLike<T7_2>, T8_2 | PromiseLike<T8_2>, T9_2 | PromiseLike<T9_2>, T10_2 | PromiseLike<T10_2>]): CancelablePromise<[T1_2, T2_2, T3_2, T4_2, T5_2, T6_2, T7_2, T8_2, T9_2, T10_2]>;
<T1_3, T2_3, T3_3, T4_3, T5_3, T6_3, T7_3, T8_3, T9_3>(values: readonly [T1_3 | PromiseLike<T1_3>, T2_3 | PromiseLike<T2_3>, T3_3 | PromiseLike<T3_3>, T4_3 | PromiseLike<T4_3>, T5_3 | PromiseLike<T5_3>, T6_3 | PromiseLike<T6_3>, T7_3 | PromiseLike<T7_3>, T8_3 | PromiseLike<T8_3>, T9_3 | PromiseLike<T9_3>]): CancelablePromise<[T1_3, T2_3, T3_3, T4_3, T5_3, T6_3, T7_3, T8_3, T9_3]>;
<T1_4, T2_4, T3_4, T4_4, T5_4, T6_4, T7_4, T8_4>(values: readonly [T1_4 | PromiseLike<T1_4>, T2_4 | PromiseLike<T2_4>, T3_4 | PromiseLike<T3_4>, T4_4 | PromiseLike<T4_4>, T5_4 | PromiseLike<T5_4>, T6_4 | PromiseLike<T6_4>, T7_4 | PromiseLike<T7_4>, T8_4 | PromiseLike<T8_4>]): CancelablePromise<[T1_4, T2_4, T3_4, T4_4, T5_4, T6_4, T7_4, T8_4]>;
<T1_5, T2_5, T3_5, T4_5, T5_5, T6_5, T7_5>(values: readonly [T1_5 | PromiseLike<T1_5>, T2_5 | PromiseLike<T2_5>, T3_5 | PromiseLike<T3_5>, T4_5 | PromiseLike<T4_5>, T5_5 | PromiseLike<T5_5>, T6_5 | PromiseLike<T6_5>, T7_5 | PromiseLike<T7_5>]): CancelablePromise<[T1_5, T2_5, T3_5, T4_5, T5_5, T6_5, T7_5]>;
<T1_6, T2_6, T3_6, T4_6, T5_6, T6_6>(values: readonly [T1_6 | PromiseLike<T1_6>, T2_6 | PromiseLike<T2_6>, T3_6 | PromiseLike<T3_6>, T4_6 | PromiseLike<T4_6>, T5_6 | PromiseLike<T5_6>, T6_6 | PromiseLike<T6_6>]): CancelablePromise<[T1_6, T2_6, T3_6, T4_6, T5_6, T6_6]>;
<T1_7, T2_7, T3_7, T4_7, T5_7>(values: readonly [T1_7 | PromiseLike<T1_7>, T2_7 | PromiseLike<T2_7>, T3_7 | PromiseLike<T3_7>, T4_7 | PromiseLike<T4_7>, T5_7 | PromiseLike<T5_7>]): CancelablePromise<[T1_7, T2_7, T3_7, T4_7, T5_7]>;
<T1_8, T2_8, T3_8, T4_8>(values: readonly [T1_8 | PromiseLike<T1_8>, T2_8 | PromiseLike<T2_8>, T3_8 | PromiseLike<T3_8>, T4_8 | PromiseLike<T4_8>]): CancelablePromise<[T1_8, T2_8, T3_8, T4_8]>;
<T1_9, T2_9, T3_9>(values: readonly [T1_9 | PromiseLike<T1_9>, T2_9 | PromiseLike<T2_9>, T3_9 | PromiseLike<T3_9>]): CancelablePromise<[T1_9, T2_9, T3_9]>;
<T1_10, T2_10>(values: readonly [T1_10 | PromiseLike<T1_10>, T2_10 | PromiseLike<T2_10>]): CancelablePromise<[T1_10, T2_10]>;
<T_1>(values: readonly (T_1 | PromiseLike<T_1>)[]): CancelablePromise<T_1[]>;
};
static all: <T_1 extends [] | readonly unknown[]>(values: T_1) => CancelablePromise<{ -readonly [P in keyof T_1]: Awaited<T_1[P]>; }>;
static allSettled: {
<T_1 extends readonly unknown[] | readonly [unknown]>(values: T_1): CancelablePromise<{ -readonly [P in keyof T_1]: PromiseSettledResult<T_1[P] extends PromiseLike<infer U> ? U : T_1[P]>; }>;
<T_2>(values: Iterable<T_2>): CancelablePromise<PromiseSettledResult<T_2 extends PromiseLike<infer U_1> ? U_1 : T_2>[]>;
<T_1 extends [] | readonly unknown[]>(values: T_1): CancelablePromise<{ -readonly [P in keyof T_1]: PromiseSettledResult<Awaited<T_1[P]>>; }>;
<T_2>(values: Iterable<T_2 | PromiseLike<T_2> | CancelablePromise<T_2>>): CancelablePromise<PromiseSettledResult<Awaited<T_2>>[]>;
};
static race: <T_1>(values: readonly T_1[]) => CancelablePromise<T_1 extends PromiseLike<infer U> ? U : T_1>;
static any: {
<T_1 extends [] | readonly unknown[]>(values: T_1): CancelablePromise<Awaited<T_1[number]>>;
<T_2>(values: Iterable<T_2 | PromiseLike<T_2> | CancelablePromise<T_2>>): CancelablePromise<Awaited<T_2>>;
};
static race: <T_1 extends [] | readonly unknown[]>(values: T_1) => CancelablePromise<Awaited<T_1[number]>>;
static resolve: {

@@ -36,0 +27,0 @@ (): CancelablePromise<void>;

{
"name": "cancelable-promise",
"version": "4.2.1",
"version": "4.3.0",
"description": "A simple cancelable promise",

@@ -75,25 +75,25 @@ "keywords": [

"devDependencies": {
"@babel/cli": "~7.14.5",
"@babel/core": "~7.14.6",
"@babel/preset-env": "~7.14.5",
"@babel/preset-typescript": "~7.14.5",
"@types/jest": "~26.0.23",
"@typescript-eslint/eslint-plugin": "~4.28.0",
"@typescript-eslint/parser": "~4.28.0",
"@babel/cli": "~7.17.0",
"@babel/core": "~7.17.0",
"@babel/preset-env": "~7.16.0",
"@babel/preset-typescript": "~7.16.0",
"@types/jest": "~27.4.0",
"@typescript-eslint/eslint-plugin": "~5.14.0",
"@typescript-eslint/parser": "~5.14.0",
"babel-eslint": "~10.1.0",
"concurrently": "~6.2.0",
"core-js": "~3.15.0",
"cypress": "~7.7.0",
"eslint": "~7.30.0",
"concurrently": "~7.0.0",
"core-js": "~3.21.0",
"cypress": "~9.5.0",
"eslint": "~8.10.0",
"express": "~4.17.1",
"fs-extra": "~10.0.0",
"husky": "~7.0.0",
"jest": "~27.0.4",
"lint-staged": "~11.0.0",
"prettier": "~2.3.1",
"jest": "~27.5.0",
"lint-staged": "~12.3.1",
"prettier": "~2.5.0",
"semver": "~7.3.5",
"terser": "~5.7.0",
"typescript": "~4.3.2",
"terser": "~5.12.0",
"typescript": "~4.6.2",
"wait-on": "~6.0.0"
}
}

@@ -77,3 +77,3 @@ # cancelable-promise

```html
<script src="https://unpkg.com/cancelable-promise@4.0.0/umd/CancelablePromise.min.js"></script>
<script src="https://unpkg.com/cancelable-promise@4.2.1/umd/CancelablePromise.min.js"></script>
<script>

@@ -87,3 +87,3 @@ const { cancelable } = window.CancelablePromise;

<script type="module">
import { cancelable } from 'https://unpkg.com/cancelable-promise@4.0.0/esm/CancelablePromise.min.mjs';
import { cancelable } from 'https://unpkg.com/cancelable-promise@4.2.1/esm/CancelablePromise.min.mjs';
cancelable(new Promise((resolve) => resolve('ok')));

@@ -90,0 +90,0 @@ </script>

@@ -124,2 +124,6 @@ class CancelablePromiseInternal<T = any> {

static any = function any(iterable: any) {
return makeAllCancelable(iterable, Promise.any(iterable));
} as CancelablePromiseOverloads['any'];
static race = function race(iterable) {

@@ -207,153 +211,28 @@ return makeAllCancelable(iterable, Promise.race(iterable));

interface CancelablePromiseOverloads {
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>,
T7 | PromiseLike<T7>,
T8 | PromiseLike<T8>,
T9 | PromiseLike<T9>,
T10 | PromiseLike<T10>,
T11 | PromiseLike<T11>,
T12 | PromiseLike<T12>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]>;
all<T extends readonly unknown[] | []>(
values: T
): CancelablePromise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>,
T7 | PromiseLike<T7>,
T8 | PromiseLike<T8>,
T9 | PromiseLike<T9>,
T10 | PromiseLike<T10>,
T11 | PromiseLike<T11>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]>;
allSettled<T extends readonly unknown[] | []>(
values: T
): CancelablePromise<{
-readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>>;
}>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>,
T7 | PromiseLike<T7>,
T8 | PromiseLike<T8>,
T9 | PromiseLike<T9>,
T10 | PromiseLike<T10>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
allSettled<T>(
values: Iterable<T | PromiseLike<T> | CancelablePromise<T>>
): CancelablePromise<PromiseSettledResult<Awaited<T>>[]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>,
T7 | PromiseLike<T7>,
T8 | PromiseLike<T8>,
T9 | PromiseLike<T9>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
any<T extends readonly unknown[] | []>(
values: T
): CancelablePromise<Awaited<T[number]>>;
all<T1, T2, T3, T4, T5, T6, T7, T8>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>,
T7 | PromiseLike<T7>,
T8 | PromiseLike<T8>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
any<T>(
values: Iterable<T | PromiseLike<T> | CancelablePromise<T>>
): CancelablePromise<Awaited<T>>;
all<T1, T2, T3, T4, T5, T6, T7>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>,
T7 | PromiseLike<T7>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7]>;
all<T1, T2, T3, T4, T5, T6>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>,
T6 | PromiseLike<T6>
]
): CancelablePromise<[T1, T2, T3, T4, T5, T6]>;
all<T1, T2, T3, T4, T5>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>,
T5 | PromiseLike<T5>
]
): CancelablePromise<[T1, T2, T3, T4, T5]>;
all<T1, T2, T3, T4>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>,
T4 | PromiseLike<T4>
]
): CancelablePromise<[T1, T2, T3, T4]>;
all<T1, T2, T3>(
values: readonly [
T1 | PromiseLike<T1>,
T2 | PromiseLike<T2>,
T3 | PromiseLike<T3>
]
): CancelablePromise<[T1, T2, T3]>;
all<T1, T2>(
values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]
): CancelablePromise<[T1, T2]>;
all<T>(values: readonly (T | PromiseLike<T>)[]): CancelablePromise<T[]>;
allSettled<T extends readonly unknown[] | readonly [unknown]>(
race<T extends readonly unknown[] | []>(
values: T
): CancelablePromise<
{
-readonly [P in keyof T]: PromiseSettledResult<
T[P] extends PromiseLike<infer U> ? U : T[P]
>;
}
>;
): CancelablePromise<Awaited<T[number]>>;
allSettled<T>(
values: Iterable<T>
): CancelablePromise<
PromiseSettledResult<T extends PromiseLike<infer U> ? U : T>[]
>;
race<T>(
values: readonly T[]
): CancelablePromise<T extends PromiseLike<infer U> ? U : T>;
resolve(): CancelablePromise<void>;

@@ -360,0 +239,0 @@

@@ -15,21 +15,12 @@ declare class CancelablePromiseInternal<T = any> {

export declare class CancelablePromise<T = any> extends CancelablePromiseInternal<T> {
static all: {
<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(values: readonly [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>, T11 | PromiseLike<T11>, T12 | PromiseLike<T12>]): CancelablePromise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]>;
<T1_1, T2_1, T3_1, T4_1, T5_1, T6_1, T7_1, T8_1, T9_1, T10_1, T11_1>(values: readonly [T1_1 | PromiseLike<T1_1>, T2_1 | PromiseLike<T2_1>, T3_1 | PromiseLike<T3_1>, T4_1 | PromiseLike<T4_1>, T5_1 | PromiseLike<T5_1>, T6_1 | PromiseLike<T6_1>, T7_1 | PromiseLike<T7_1>, T8_1 | PromiseLike<T8_1>, T9_1 | PromiseLike<T9_1>, T10_1 | PromiseLike<T10_1>, T11_1 | PromiseLike<T11_1>]): CancelablePromise<[T1_1, T2_1, T3_1, T4_1, T5_1, T6_1, T7_1, T8_1, T9_1, T10_1, T11_1]>;
<T1_2, T2_2, T3_2, T4_2, T5_2, T6_2, T7_2, T8_2, T9_2, T10_2>(values: readonly [T1_2 | PromiseLike<T1_2>, T2_2 | PromiseLike<T2_2>, T3_2 | PromiseLike<T3_2>, T4_2 | PromiseLike<T4_2>, T5_2 | PromiseLike<T5_2>, T6_2 | PromiseLike<T6_2>, T7_2 | PromiseLike<T7_2>, T8_2 | PromiseLike<T8_2>, T9_2 | PromiseLike<T9_2>, T10_2 | PromiseLike<T10_2>]): CancelablePromise<[T1_2, T2_2, T3_2, T4_2, T5_2, T6_2, T7_2, T8_2, T9_2, T10_2]>;
<T1_3, T2_3, T3_3, T4_3, T5_3, T6_3, T7_3, T8_3, T9_3>(values: readonly [T1_3 | PromiseLike<T1_3>, T2_3 | PromiseLike<T2_3>, T3_3 | PromiseLike<T3_3>, T4_3 | PromiseLike<T4_3>, T5_3 | PromiseLike<T5_3>, T6_3 | PromiseLike<T6_3>, T7_3 | PromiseLike<T7_3>, T8_3 | PromiseLike<T8_3>, T9_3 | PromiseLike<T9_3>]): CancelablePromise<[T1_3, T2_3, T3_3, T4_3, T5_3, T6_3, T7_3, T8_3, T9_3]>;
<T1_4, T2_4, T3_4, T4_4, T5_4, T6_4, T7_4, T8_4>(values: readonly [T1_4 | PromiseLike<T1_4>, T2_4 | PromiseLike<T2_4>, T3_4 | PromiseLike<T3_4>, T4_4 | PromiseLike<T4_4>, T5_4 | PromiseLike<T5_4>, T6_4 | PromiseLike<T6_4>, T7_4 | PromiseLike<T7_4>, T8_4 | PromiseLike<T8_4>]): CancelablePromise<[T1_4, T2_4, T3_4, T4_4, T5_4, T6_4, T7_4, T8_4]>;
<T1_5, T2_5, T3_5, T4_5, T5_5, T6_5, T7_5>(values: readonly [T1_5 | PromiseLike<T1_5>, T2_5 | PromiseLike<T2_5>, T3_5 | PromiseLike<T3_5>, T4_5 | PromiseLike<T4_5>, T5_5 | PromiseLike<T5_5>, T6_5 | PromiseLike<T6_5>, T7_5 | PromiseLike<T7_5>]): CancelablePromise<[T1_5, T2_5, T3_5, T4_5, T5_5, T6_5, T7_5]>;
<T1_6, T2_6, T3_6, T4_6, T5_6, T6_6>(values: readonly [T1_6 | PromiseLike<T1_6>, T2_6 | PromiseLike<T2_6>, T3_6 | PromiseLike<T3_6>, T4_6 | PromiseLike<T4_6>, T5_6 | PromiseLike<T5_6>, T6_6 | PromiseLike<T6_6>]): CancelablePromise<[T1_6, T2_6, T3_6, T4_6, T5_6, T6_6]>;
<T1_7, T2_7, T3_7, T4_7, T5_7>(values: readonly [T1_7 | PromiseLike<T1_7>, T2_7 | PromiseLike<T2_7>, T3_7 | PromiseLike<T3_7>, T4_7 | PromiseLike<T4_7>, T5_7 | PromiseLike<T5_7>]): CancelablePromise<[T1_7, T2_7, T3_7, T4_7, T5_7]>;
<T1_8, T2_8, T3_8, T4_8>(values: readonly [T1_8 | PromiseLike<T1_8>, T2_8 | PromiseLike<T2_8>, T3_8 | PromiseLike<T3_8>, T4_8 | PromiseLike<T4_8>]): CancelablePromise<[T1_8, T2_8, T3_8, T4_8]>;
<T1_9, T2_9, T3_9>(values: readonly [T1_9 | PromiseLike<T1_9>, T2_9 | PromiseLike<T2_9>, T3_9 | PromiseLike<T3_9>]): CancelablePromise<[T1_9, T2_9, T3_9]>;
<T1_10, T2_10>(values: readonly [T1_10 | PromiseLike<T1_10>, T2_10 | PromiseLike<T2_10>]): CancelablePromise<[T1_10, T2_10]>;
<T_1>(values: readonly (T_1 | PromiseLike<T_1>)[]): CancelablePromise<T_1[]>;
};
static all: <T_1 extends [] | readonly unknown[]>(values: T_1) => CancelablePromise<{ -readonly [P in keyof T_1]: Awaited<T_1[P]>; }>;
static allSettled: {
<T_1 extends readonly unknown[] | readonly [unknown]>(values: T_1): CancelablePromise<{ -readonly [P in keyof T_1]: PromiseSettledResult<T_1[P] extends PromiseLike<infer U> ? U : T_1[P]>; }>;
<T_2>(values: Iterable<T_2>): CancelablePromise<PromiseSettledResult<T_2 extends PromiseLike<infer U_1> ? U_1 : T_2>[]>;
<T_1 extends [] | readonly unknown[]>(values: T_1): CancelablePromise<{ -readonly [P in keyof T_1]: PromiseSettledResult<Awaited<T_1[P]>>; }>;
<T_2>(values: Iterable<T_2 | PromiseLike<T_2> | CancelablePromise<T_2>>): CancelablePromise<PromiseSettledResult<Awaited<T_2>>[]>;
};
static race: <T_1>(values: readonly T_1[]) => CancelablePromise<T_1 extends PromiseLike<infer U> ? U : T_1>;
static any: {
<T_1 extends [] | readonly unknown[]>(values: T_1): CancelablePromise<Awaited<T_1[number]>>;
<T_2>(values: Iterable<T_2 | PromiseLike<T_2> | CancelablePromise<T_2>>): CancelablePromise<Awaited<T_2>>;
};
static race: <T_1 extends [] | readonly unknown[]>(values: T_1) => CancelablePromise<Awaited<T_1[number]>>;
static resolve: {

@@ -36,0 +27,0 @@ (): CancelablePromise<void>;

@@ -1,2 +0,2 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

@@ -21,7 +21,8 @@ (function (global, factory) {

});
_exports.CancelablePromise = void 0;
_exports.cancelable = cancelable;
_exports.default = void 0;
_exports.isCancelablePromise = isCancelablePromise;
_exports.default = _exports.CancelablePromise = void 0;
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -32,3 +33,3 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }

@@ -53,4 +54,8 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }

@@ -85,3 +90,3 @@

_internals.set(this, {
_classPrivateFieldInitSpec(this, _internals, {
writable: true,

@@ -91,3 +96,3 @@ value: void 0

_promise.set(this, {
_classPrivateFieldInitSpec(this, _promise, {
writable: true,

@@ -192,3 +197,3 @@ value: void 0

return CancelablePromise;
return _createClass(CancelablePromise);
}(CancelablePromiseInternal);

@@ -206,2 +211,6 @@

_defineProperty(CancelablePromise, "any", function any(iterable) {
return makeAllCancelable(iterable, Promise.any(iterable));
});
_defineProperty(CancelablePromise, "race", function race(iterable) {

@@ -208,0 +217,0 @@ return makeAllCancelable(iterable, Promise.race(iterable));

@@ -1,2 +0,2 @@

function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.CancelablePromise=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){"use strict";function t(e,n){return(t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,n)}function n(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=o(e);if(t){var u=o(this).constructor;n=Reflect.construct(i,arguments,u)}else n=i.apply(this,arguments);return r(this,n)}}function r(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){a=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return function(e,t){if(t.get)return t.get.call(e);return t.value}(e,p(e,t,"get"))}function s(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,p(e,t,"set"),n),n}function p(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.cancelable=m,e.isCancelablePromise=w,e.default=e.CancelablePromise=void 0;var y=new WeakMap,h=new WeakMap,v=function(){function e(t){var n=t.executor,r=void 0===n?function(){}:n,o=t.internals,i=void 0===o?{isCanceled:!1,onCancelList:[]}:o,u=t.promise,c=void 0===u?new Promise((function(e,t){return r(e,t,(function(e){i.onCancelList.push(e)}))})):u;a(this,e),y.set(this,{writable:!0,value:void 0}),h.set(this,{writable:!0,value:void 0}),this.cancel=this.cancel.bind(this),s(this,y,i),s(this,h,c||new Promise((function(e,t){return r(e,t,(function(e){i.onCancelList.push(e)}))})))}var t,n,r;return t=e,(n=[{key:"then",value:function(e,t){return g(l(this,h).then(C(e,l(this,y)),C(t,l(this,y))),l(this,y))}},{key:"catch",value:function(e){return g(l(this,h).catch(C(e,l(this,y))),l(this,y))}},{key:"finally",value:function(e,t){var n=this;return t&&l(this,y).onCancelList.push(e),g(l(this,h).finally(C((function(){if(e)return t&&(l(n,y).onCancelList=l(n,y).onCancelList.filter((function(t){return t!==e}))),e()}),l(this,y))),l(this,y))}},{key:"cancel",value:function(){l(this,y).isCanceled=!0;var e=l(this,y).onCancelList;l(this,y).onCancelList=[];var t,n=u(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if("function"==typeof r)try{r()}catch(e){console.error(e)}}}catch(e){n.e(e)}finally{n.f()}}},{key:"isCanceled",value:function(){return!0===l(this,y).isCanceled}}])&&f(t.prototype,n),r&&f(t,r),e}(),d=function(e){!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),n&&t(e,n)}(o,e);var r=n(o);function o(e){return a(this,o),r.call(this,{executor:e})}return o}(v);e.CancelablePromise=d,i(d,"all",(function(e){return P(e,Promise.all(e))})),i(d,"allSettled",(function(e){return P(e,Promise.allSettled(e))})),i(d,"race",(function(e){return P(e,Promise.race(e))})),i(d,"resolve",(function(e){return m(Promise.resolve(e))})),i(d,"reject",(function(e){return m(Promise.reject(e))})),i(d,"isCancelable",w);var b=d;function m(e){return g(e,{isCanceled:!1,onCancelList:[]})}function w(e){return e instanceof d||e instanceof v}function C(e,t){if(e)return function(n){if(!t.isCanceled){var r=e(n);return w(r)&&t.onCancelList.push(r.cancel),r}return n}}function g(e,t){return new v({internals:t,promise:e})}function P(e,t){var n={isCanceled:!1,onCancelList:[]};return n.onCancelList.push((function(){var t,n=u(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;w(r)&&r.cancel()}}catch(e){n.e(e)}finally{n.f()}})),new v({internals:n,promise:t})}e.default=b}));
function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("undefined"!=typeof exports)t(exports);else{var n={exports:{}};t(n.exports),e.CancelablePromise=n.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(e){"use strict";function t(e,n){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,n)}function n(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=o(e);if(t){var u=o(this).constructor;n=Reflect.construct(i,arguments,u)}else n=i.apply(this,arguments);return r(this,n)}}function r(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){a=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw i}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}function p(e,t){return function(e,t){if(t.get)return t.get.call(e);return t.value}(e,h(e,t,"get"))}function y(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,h(e,t,"set"),n),n}function h(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.CancelablePromise=void 0,e.cancelable=C,e.default=void 0,e.isCancelablePromise=P;var d=new WeakMap,v=new WeakMap,b=function(){function e(t){var n=t.executor,r=void 0===n?function(){}:n,o=t.internals,i=void 0===o?{isCanceled:!1,onCancelList:[]}:o,u=t.promise,c=void 0===u?new Promise((function(e,t){return r(e,t,(function(e){i.onCancelList.push(e)}))})):u;a(this,e),s(this,d,{writable:!0,value:void 0}),s(this,v,{writable:!0,value:void 0}),this.cancel=this.cancel.bind(this),y(this,d,i),y(this,v,c||new Promise((function(e,t){return r(e,t,(function(e){i.onCancelList.push(e)}))})))}return l(e,[{key:"then",value:function(e,t){return j(p(this,v).then(g(e,p(this,d)),g(t,p(this,d))),p(this,d))}},{key:"catch",value:function(e){return j(p(this,v).catch(g(e,p(this,d))),p(this,d))}},{key:"finally",value:function(e,t){var n=this;return t&&p(this,d).onCancelList.push(e),j(p(this,v).finally(g((function(){if(e)return t&&(p(n,d).onCancelList=p(n,d).onCancelList.filter((function(t){return t!==e}))),e()}),p(this,d))),p(this,d))}},{key:"cancel",value:function(){p(this,d).isCanceled=!0;var e=p(this,d).onCancelList;p(this,d).onCancelList=[];var t,n=u(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;if("function"==typeof r)try{r()}catch(e){console.error(e)}}}catch(e){n.e(e)}finally{n.f()}}},{key:"isCanceled",value:function(){return!0===p(this,d).isCanceled}}]),e}(),m=function(e){!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&t(e,n)}(o,e);var r=n(o);function o(e){return a(this,o),r.call(this,{executor:e})}return l(o)}(b);e.CancelablePromise=m,i(m,"all",(function(e){return O(e,Promise.all(e))})),i(m,"allSettled",(function(e){return O(e,Promise.allSettled(e))})),i(m,"any",(function(e){return O(e,Promise.any(e))})),i(m,"race",(function(e){return O(e,Promise.race(e))})),i(m,"resolve",(function(e){return C(Promise.resolve(e))})),i(m,"reject",(function(e){return C(Promise.reject(e))})),i(m,"isCancelable",P);var w=m;function C(e){return j(e,{isCanceled:!1,onCancelList:[]})}function P(e){return e instanceof m||e instanceof b}function g(e,t){if(e)return function(n){if(!t.isCanceled){var r=e(n);return P(r)&&t.onCancelList.push(r.cancel),r}return n}}function j(e,t){return new b({internals:t,promise:e})}function O(e,t){var n={isCanceled:!1,onCancelList:[]};return n.onCancelList.push((function(){var t,n=u(e);try{for(n.s();!(t=n.n()).done;){var r=t.value;P(r)&&r.cancel()}}catch(e){n.e(e)}finally{n.f()}})),new b({internals:n,promise:t})}e.default=w}));
//# sourceMappingURL=CancelablePromise.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc