Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function hasInstance(value: unknown): value is ReadonlyKeyedCollection {
return isIterable(value)
&& ReadonlyKeyedCollection.size in value
&& ReadonlyKeyedCollection.has in value
&& ReadonlyKeyedCollection.get in value
&& ReadonlyKeyedCollection.keys in value
&& ReadonlyKeyedCollection.values in value;
}
}
export function isReadonlyCollection(value: any): value is ReadonlyCollection {
return isIterable(value)
&& ReadonlyCollection.size in value
&& ReadonlyCollection.has in value;
}
static all(cancelables: Iterable) {
if (!isIterable(cancelables)) {
throw new TypeError("Object not iterable: cancelables");
}
const signals: CancelSignal[] = [];
for (const cancelable of cancelables) {
if (!Cancelable.hasInstance(cancelable)) throw new TypeError("Cancelable element expected: cancelables");
signals.push(cancelable[Cancelable.cancelSignal]());
}
if (!signals.some(canBeSignaled)) {
return CancelToken.none;
}
if (signals.every(isSignaled)) {
return CancelToken.canceled;
}
let signalsRemaining = signals.length;
const subscriptions: CancelSubscription[] = [];
const source = createCancelSource({
export function hasInstance(value: any): value is ReadonlyCollection {
return isIterable(value)
&& ReadonlyCollection.size in value
&& ReadonlyCollection.has in value;
}
}
static race(cancelables: Iterable) {
if (!isIterable(cancelables)) {
throw new TypeError("Object not iterable: cancelables");
}
const signals: CancelSignal[] = [];
for (const cancelable of cancelables) {
if (!Cancelable.hasInstance(cancelable)) throw new TypeError("Cancelable element expected: cancelables");
signals.push(cancelable[Cancelable.cancelSignal]());
}
if (!signals.some(canBeSignaled)) {
return CancelToken.none;
}
if (signals.some(isSignaled)) {
return CancelToken.canceled;
}
const subscriptions: CancelSubscription[] = [];
const source = createCancelSource({
getLinkedState() {