Socket
Socket
Sign inDemoInstall

rxjs

Package Overview
Dependencies
1
Maintainers
3
Versions
165
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.5.5 to 7.5.6

dist/cjs/internal/scheduler/timerHandle.js

4

dist/cjs/internal/operators/connect.js

@@ -5,3 +5,3 @@ "use strict";

var Subject_1 = require("../Subject");
var from_1 = require("../observable/from");
var innerFrom_1 = require("../observable/innerFrom");
var lift_1 = require("../util/lift");

@@ -17,3 +17,3 @@ var fromSubscribable_1 = require("../observable/fromSubscribable");

var subject = connector();
from_1.from(selector(fromSubscribable_1.fromSubscribable(subject))).subscribe(subscriber);
innerFrom_1.innerFrom(selector(fromSubscribable_1.fromSubscribable(subject))).subscribe(subscriber);
subscriber.add(source.subscribe(subject));

@@ -20,0 +20,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.exhaustAll = void 0;
var lift_1 = require("../util/lift");
var innerFrom_1 = require("../observable/innerFrom");
var OperatorSubscriber_1 = require("./OperatorSubscriber");
var exhaustMap_1 = require("./exhaustMap");
var identity_1 = require("../util/identity");
function exhaustAll() {
return lift_1.operate(function (source, subscriber) {
var isComplete = false;
var innerSub = null;
source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (inner) {
if (!innerSub) {
innerSub = innerFrom_1.innerFrom(inner).subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, undefined, function () {
innerSub = null;
isComplete && subscriber.complete();
}));
}
}, function () {
isComplete = true;
!innerSub && subscriber.complete();
}));
});
return exhaustMap_1.exhaustMap(identity_1.identity);
}
exports.exhaustAll = exhaustAll;
//# sourceMappingURL=exhaustAll.js.map

@@ -25,4 +25,3 @@ "use strict";

exports.share = void 0;
var from_1 = require("../observable/from");
var take_1 = require("../operators/take");
var innerFrom_1 = require("../observable/innerFrom");
var Subject_1 = require("../Subject");

@@ -35,5 +34,5 @@ var Subscriber_1 = require("../Subscriber");

return function (wrapperSource) {
var connection = null;
var resetConnection = null;
var subject = null;
var connection;
var resetConnection;
var subject;
var refCount = 0;

@@ -44,7 +43,7 @@ var hasCompleted = false;

resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
resetConnection = null;
resetConnection = undefined;
};
var reset = function () {
cancelReset();
connection = subject = null;
connection = subject = undefined;
hasCompleted = hasErrored = false;

@@ -70,3 +69,4 @@ };

dest.subscribe(subscriber);
if (!connection) {
if (!connection &&
refCount > 0) {
connection = new Subscriber_1.SafeSubscriber({

@@ -87,3 +87,3 @@ next: function (value) { return dest.next(value); },

});
from_1.from(source).subscribe(connection);
innerFrom_1.innerFrom(source).subscribe(connection);
}

@@ -101,10 +101,15 @@ })(wrapperSource);

reset();
return null;
return;
}
if (on === false) {
return null;
return;
}
return on.apply(void 0, __spreadArray([], __read(args))).pipe(take_1.take(1))
.subscribe(function () { return reset(); });
var onSubscriber = new Subscriber_1.SafeSubscriber({
next: function () {
onSubscriber.unsubscribe();
reset();
},
});
return on.apply(void 0, __spreadArray([], __read(args))).subscribe(onSubscriber);
}
//# sourceMappingURL=share.js.map

@@ -14,3 +14,3 @@ "use strict";

else {
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
}

@@ -17,0 +17,0 @@ return share_1.share({

@@ -154,3 +154,3 @@ "use strict";

partialObserver = {
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
error: error !== null && error !== void 0 ? error : undefined,

@@ -157,0 +157,0 @@ complete: complete !== null && complete !== void 0 ? complete : undefined,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=workarounds.js.map
import { Subject } from '../Subject';
import { from } from '../observable/from';
import { innerFrom } from '../observable/innerFrom';
import { operate } from '../util/lift';

@@ -12,3 +12,3 @@ import { fromSubscribable } from '../observable/fromSubscribable';

const subject = connector();
from(selector(fromSubscribable(subject))).subscribe(subscriber);
innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);
subscriber.add(source.subscribe(subject));

@@ -15,0 +15,0 @@ });

@@ -1,21 +0,6 @@

import { operate } from '../util/lift';
import { innerFrom } from '../observable/innerFrom';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { exhaustMap } from './exhaustMap';
import { identity } from '../util/identity';
export function exhaustAll() {
return operate((source, subscriber) => {
let isComplete = false;
let innerSub = null;
source.subscribe(createOperatorSubscriber(subscriber, (inner) => {
if (!innerSub) {
innerSub = innerFrom(inner).subscribe(createOperatorSubscriber(subscriber, undefined, () => {
innerSub = null;
isComplete && subscriber.complete();
}));
}
}, () => {
isComplete = true;
!innerSub && subscriber.complete();
}));
});
return exhaustMap(identity);
}
//# sourceMappingURL=exhaustAll.js.map

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

import { from } from '../observable/from';
import { take } from '../operators/take';
import { innerFrom } from '../observable/innerFrom';
import { Subject } from '../Subject';

@@ -9,5 +8,5 @@ import { SafeSubscriber } from '../Subscriber';

return (wrapperSource) => {
let connection = null;
let resetConnection = null;
let subject = null;
let connection;
let resetConnection;
let subject;
let refCount = 0;

@@ -18,7 +17,7 @@ let hasCompleted = false;

resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
resetConnection = null;
resetConnection = undefined;
};
const reset = () => {
cancelReset();
connection = subject = null;
connection = subject = undefined;
hasCompleted = hasErrored = false;

@@ -44,3 +43,4 @@ };

dest.subscribe(subscriber);
if (!connection) {
if (!connection &&
refCount > 0) {
connection = new SafeSubscriber({

@@ -61,3 +61,3 @@ next: (value) => dest.next(value),

});
from(source).subscribe(connection);
innerFrom(source).subscribe(connection);
}

@@ -70,11 +70,15 @@ })(wrapperSource);

reset();
return null;
return;
}
if (on === false) {
return null;
return;
}
return on(...args)
.pipe(take(1))
.subscribe(() => reset());
const onSubscriber = new SafeSubscriber({
next: () => {
onSubscriber.unsubscribe();
reset();
},
});
return on(...args).subscribe(onSubscriber);
}
//# sourceMappingURL=share.js.map

@@ -10,3 +10,3 @@ import { ReplaySubject } from '../ReplaySubject';

else {
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
}

@@ -13,0 +13,0 @@ return share({

@@ -130,3 +130,3 @@ import { isFunction } from './util/isFunction';

partialObserver = {
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
error: error !== null && error !== void 0 ? error : undefined,

@@ -133,0 +133,0 @@ complete: complete !== null && complete !== void 0 ? complete : undefined,

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

"use strict";
export {};
//# sourceMappingURL=workarounds.js.map
import { Subject } from '../Subject';
import { from } from '../observable/from';
import { innerFrom } from '../observable/innerFrom';
import { operate } from '../util/lift';

@@ -13,3 +13,3 @@ import { fromSubscribable } from '../observable/fromSubscribable';

var subject = connector();
from(selector(fromSubscribable(subject))).subscribe(subscriber);
innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);
subscriber.add(source.subscribe(subject));

@@ -16,0 +16,0 @@ });

@@ -1,21 +0,6 @@

import { operate } from '../util/lift';
import { innerFrom } from '../observable/innerFrom';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { exhaustMap } from './exhaustMap';
import { identity } from '../util/identity';
export function exhaustAll() {
return operate(function (source, subscriber) {
var isComplete = false;
var innerSub = null;
source.subscribe(createOperatorSubscriber(subscriber, function (inner) {
if (!innerSub) {
innerSub = innerFrom(inner).subscribe(createOperatorSubscriber(subscriber, undefined, function () {
innerSub = null;
isComplete && subscriber.complete();
}));
}
}, function () {
isComplete = true;
!innerSub && subscriber.complete();
}));
});
return exhaustMap(identity);
}
//# sourceMappingURL=exhaustAll.js.map
import { __read, __spreadArray } from "tslib";
import { from } from '../observable/from';
import { take } from '../operators/take';
import { innerFrom } from '../observable/innerFrom';
import { Subject } from '../Subject';

@@ -11,5 +10,5 @@ import { SafeSubscriber } from '../Subscriber';

return function (wrapperSource) {
var connection = null;
var resetConnection = null;
var subject = null;
var connection;
var resetConnection;
var subject;
var refCount = 0;

@@ -20,7 +19,7 @@ var hasCompleted = false;

resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();
resetConnection = null;
resetConnection = undefined;
};
var reset = function () {
cancelReset();
connection = subject = null;
connection = subject = undefined;
hasCompleted = hasErrored = false;

@@ -46,3 +45,4 @@ };

dest.subscribe(subscriber);
if (!connection) {
if (!connection &&
refCount > 0) {
connection = new SafeSubscriber({

@@ -63,3 +63,3 @@ next: function (value) { return dest.next(value); },

});
from(source).subscribe(connection);
innerFrom(source).subscribe(connection);
}

@@ -76,10 +76,15 @@ })(wrapperSource);

reset();
return null;
return;
}
if (on === false) {
return null;
return;
}
return on.apply(void 0, __spreadArray([], __read(args))).pipe(take(1))
.subscribe(function () { return reset(); });
var onSubscriber = new SafeSubscriber({
next: function () {
onSubscriber.unsubscribe();
reset();
},
});
return on.apply(void 0, __spreadArray([], __read(args))).subscribe(onSubscriber);
}
//# sourceMappingURL=share.js.map

@@ -11,3 +11,3 @@ import { ReplaySubject } from '../ReplaySubject';

else {
bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;
bufferSize = (configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity);
}

@@ -14,0 +14,0 @@ return share({

@@ -137,3 +137,3 @@ import { __extends } from "tslib";

partialObserver = {
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
error: error !== null && error !== void 0 ? error : undefined,

@@ -140,0 +140,0 @@ complete: complete !== null && complete !== void 0 ? complete : undefined,

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

"use strict";
export {};
//# sourceMappingURL=workarounds.js.map

@@ -64,3 +64,3 @@ import { Operator } from './Operator';

*
* ## Example
* #### Example
*

@@ -67,0 +67,0 @@ * ```ts

import { Observable } from '../Observable';
import { ObservableInput, ReadableStreamLike } from '../types';
export declare function innerFrom<T>(input: ObservableInput<T>): Observable<T>;
import { ObservableInput, ObservedValueOf, ReadableStreamLike } from '../types';
export declare function innerFrom<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;
/**

@@ -5,0 +5,0 @@ * Creates an RxJS Observable from an object that implements `Symbol.observable`.

@@ -10,3 +10,3 @@ import { ObservableInput, OperatorFunction } from '../types';

*
* ![](bufferWhen.png)
* ![](bufferWhen.svg)
*

@@ -13,0 +13,0 @@ * Opens a buffer immediately, then closes the buffer when the observable

import { MonoTypeOperatorFunction } from '../types';
/**
* Returns a result {@link Observable} that emits all values pushed by the source observable if they
* are distinct in comparison to the last value the result observable emitted.
*
* 1. It will always emit the first value from the source.
* 2. For all subsequent values pushed by the source, they will be compared to the previously emitted values
* using the provided `comparator` or an `===` equality check.
* 3. If the value pushed by the source is determined to be unequal by this check, that value is emitted and
* becomes the new "previously emitted value" internally.
*
* ## Examples
*
* A very basic example with no `comparator`. Note that `1` is emitted more than once,
* because it's distinct in comparison to the _previously emitted_ value,
* not in comparison to _all other emitted values_.
*
* ```ts
* import { of, distinctUntilChanged } from 'rxjs';
*
* of(1, 1, 1, 2, 2, 2, 1, 1, 3, 3)
* .pipe(distinctUntilChanged())
* .subscribe(console.log);
* // Logs: 1, 2, 1, 3
* ```
*
* With a `comparator`, you can do custom comparisons. Let's say
* you only want to emit a value when all of its components have
* changed:
*
* ```ts
* import { of, distinctUntilChanged } from 'rxjs';
*
* const totallyDifferentBuilds$ = of(
* { engineVersion: '1.1.0', transmissionVersion: '1.2.0' },
* { engineVersion: '1.1.0', transmissionVersion: '1.4.0' },
* { engineVersion: '1.3.0', transmissionVersion: '1.4.0' },
* { engineVersion: '1.3.0', transmissionVersion: '1.5.0' },
* { engineVersion: '2.0.0', transmissionVersion: '1.5.0' }
* ).pipe(
* distinctUntilChanged((prev, curr) => {
* return (
* prev.engineVersion === curr.engineVersion ||
* prev.transmissionVersion === curr.transmissionVersion
* );
* })
* );
*
* totallyDifferentBuilds$.subscribe(console.log);
*
* // Logs:
* // { engineVersion: '1.1.0', transmissionVersion: '1.2.0' }
* // { engineVersion: '1.3.0', transmissionVersion: '1.4.0' }
* // { engineVersion: '2.0.0', transmissionVersion: '1.5.0' }
* ```
*
* You can also provide a custom `comparator` to check that emitted
* changes are only in one direction. Let's say you only want to get
* the next record temperature:
*
* ```ts
* import { of, distinctUntilChanged } from 'rxjs';
*
* const temps$ = of(30, 31, 20, 34, 33, 29, 35, 20);
*
* const recordHighs$ = temps$.pipe(
* distinctUntilChanged((prevHigh, temp) => {
* // If the current temp is less than
* // or the same as the previous record,
* // the record hasn't changed.
* return temp <= prevHigh;
* })
* );
*
* recordHighs$.subscribe(console.log);
* // Logs: 30, 31, 34, 35
* ```
*
* @param comparator A function used to compare the previous and current values for
* equality. Defaults to a `===` check.
* @return A function that returns an Observable that emits items from the
* source Observable with distinct values.
*/
export declare function distinctUntilChanged<T>(comparator?: (previous: T, current: T) => boolean): MonoTypeOperatorFunction<T>;
/**
* Returns a result {@link Observable} that emits all values pushed by the source observable if they
* are distinct in comparison to the last value the result observable emitted.
*
* 1. It will always emit the first value from the source.
* 2. The `keySelector` will be run against all values, including the first value.
* 3. For all values after the first, the selected key will be compared against the key selected from
* the previously emitted value using the `comparator`.
* 4. If the keys are determined to be unequal by this check, the value (not the key), is emitted
* and the selected key from that value is saved for future comparisons against other keys.
*
* ## Example
*
* Selecting update events only when the `updatedBy` field shows
* the account changed hands...
*
* ```ts
* import { of, distinctUntilChanged } from 'rxjs';
*
* // A stream of updates to a given account
* const accountUpdates$ = of(
* { updatedBy: 'blesh', data: [] },
* { updatedBy: 'blesh', data: [] },
* { updatedBy: 'ncjamieson', data: [] },
* { updatedBy: 'ncjamieson', data: [] },
* { updatedBy: 'blesh', data: [] }
* );
*
* // We only want the events where it changed hands
* const changedHands$ = accountUpdates$.pipe(
* distinctUntilChanged(undefined, update => update.updatedBy)
* );
*
* changedHands$.subscribe(console.log);
* // Logs:
* // { updatedBy: 'blesh', data: Array[0] }
* // { updatedBy: 'ncjamieson', data: Array[0] }
* // { updatedBy: 'blesh', data: Array[0] }
* ```
*
* @param comparator A function used to compare the previous and current keys for
* equality. Defaults to a `===` check.
* @param keySelector Used to select a key value to be passed to the `comparator`.
* @return A function that returns an Observable that emits items from the
* source Observable with distinct values.
*/
export declare function distinctUntilChanged<T, K>(comparator: (previous: K, current: K) => boolean, keySelector: (value: T) => K): MonoTypeOperatorFunction<T>;
//# sourceMappingURL=distinctUntilChanged.d.ts.map
import { OperatorFunction } from '../types';
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T>(k1: K1): OperatorFunction<T, T[K1]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T, K2 extends keyof T[K1]>(k1: K1, k2: K2): OperatorFunction<T, T[K1][K2]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(k1: K1, k2: K2, k3: K3): OperatorFunction<T, T[K1][K2][K3]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(k1: K1, k2: K2, k3: K3, k4: K4): OperatorFunction<T, T[K1][K2][K3][K4]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], K5 extends keyof T[K1][K2][K3][K4]>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction<T, T[K1][K2][K3][K4][K5]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], K5 extends keyof T[K1][K2][K3][K4], K6 extends keyof T[K1][K2][K3][K4][K5]>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction<T, T[K1][K2][K3][K4][K5][K6]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3], K5 extends keyof T[K1][K2][K3][K4], K6 extends keyof T[K1][K2][K3][K4][K5]>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction<T, unknown>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export declare function pluck<T>(...properties: string[]): OperatorFunction<T, unknown>;
//# sourceMappingURL=pluck.d.ts.map

@@ -56,5 +56,5 @@ import { Observable } from '../Observable';

* Observable with the exception of an `error`.
* @deprecated: Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.
* @deprecated Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.
*/
export declare function retryWhen<T>(notifier: (errors: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T>;
//# sourceMappingURL=retryWhen.d.ts.map
import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types';
/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */
/** @deprecated Will be removed in v9. Use {@link switchMap} instead: `switchMap(() => result)` */
export declare function switchMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;

@@ -4,0 +4,0 @@ /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */

@@ -1,3 +0,4 @@

declare type SetImmediateFunction = (handler: () => void, ...args: any[]) => number;
declare type ClearImmediateFunction = (handle: number) => void;
import type { TimerHandle } from './timerHandle';
declare type SetImmediateFunction = (handler: () => void, ...args: any[]) => TimerHandle;
declare type ClearImmediateFunction = (handle: TimerHandle) => void;
interface ImmediateProvider {

@@ -4,0 +5,0 @@ setImmediate: SetImmediateFunction;

@@ -1,3 +0,4 @@

declare type SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;
declare type ClearIntervalFunction = (handle: number) => void;
import type { TimerHandle } from './timerHandle';
declare type SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;
declare type ClearIntervalFunction = (handle: TimerHandle) => void;
interface IntervalProvider {

@@ -4,0 +5,0 @@ setInterval: SetIntervalFunction;

@@ -1,3 +0,4 @@

declare type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;
declare type ClearTimeoutFunction = (handle: number) => void;
import type { TimerHandle } from './timerHandle';
declare type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;
declare type ClearTimeoutFunction = (handle: TimerHandle) => void;
interface TimeoutProvider {

@@ -4,0 +5,0 @@ setTimeout: SetTimeoutFunction;

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

export {};
//# sourceMappingURL=workarounds.d.ts.map
{
"name": "rxjs",
"version": "7.5.5",
"version": "7.5.6",
"description": "Reactive Extensions for modern JavaScript",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

@@ -124,3 +124,3 @@ import { Operator } from './Operator';

*
* ## Examples
* #### Examples
*

@@ -265,3 +265,3 @@ * Subscribe with an {@link guide/observer Observer}

*
* ## Example
* #### Example
*

@@ -268,0 +268,0 @@ * ```ts

import { isArrayLike } from '../util/isArrayLike';
import { isPromise } from '../util/isPromise';
import { Observable } from '../Observable';
import { ObservableInput, ReadableStreamLike } from '../types';
import { ObservableInput, ObservedValueOf, ReadableStreamLike } from '../types';
import { isInteropObservable } from '../util/isInteropObservable';

@@ -15,2 +15,3 @@ import { isAsyncIterable } from '../util/isAsyncIterable';

export function innerFrom<O extends ObservableInput<any>>(input: O): Observable<ObservedValueOf<O>>;
export function innerFrom<T>(input: ObservableInput<T>): Observable<T> {

@@ -17,0 +18,0 @@ if (input instanceof Observable) {

@@ -16,3 +16,3 @@ import { Subscriber } from '../Subscriber';

*
* ![](bufferWhen.png)
* ![](bufferWhen.svg)
*

@@ -19,0 +19,0 @@ * Opens a buffer immediately, then closes the buffer when the observable

import { OperatorFunction, ObservableInput, ObservedValueOf, SubjectLike } from '../types';
import { Observable } from '../Observable';
import { Subject } from '../Subject';
import { from } from '../observable/from';
import { innerFrom } from '../observable/innerFrom';
import { operate } from '../util/lift';

@@ -106,5 +106,5 @@ import { fromSubscribable } from '../observable/fromSubscribable';

const subject = connector();
from(selector(fromSubscribable(subject))).subscribe(subscriber);
innerFrom(selector(fromSubscribable(subject))).subscribe(subscriber);
subscriber.add(source.subscribe(subject));
});
}

@@ -6,2 +6,8 @@ import { MonoTypeOperatorFunction } from '../types';

export function distinctUntilChanged<T>(comparator?: (previous: T, current: T) => boolean): MonoTypeOperatorFunction<T>;
export function distinctUntilChanged<T, K>(
comparator: (previous: K, current: K) => boolean,
keySelector: (value: T) => K
): MonoTypeOperatorFunction<T>;
/**

@@ -11,2 +17,5 @@ * Returns a result {@link Observable} that emits all values pushed by the source observable if they

*
* When provided without parameters or with the first parameter (`{@link distinctUntilChanged#comparator comparator}`),
* it behaves like this:
*
* 1. It will always emit the first value from the source.

@@ -18,5 +27,15 @@ * 2. For all subsequent values pushed by the source, they will be compared to the previously emitted values

*
* When the second parameter (`{@link distinctUntilChanged#keySelector keySelector}`) is provided, the behavior
* changes:
*
* 1. It will always emit the first value from the source.
* 2. The `keySelector` will be run against all values, including the first value.
* 3. For all values after the first, the selected key will be compared against the key selected from
* the previously emitted value using the `comparator`.
* 4. If the keys are determined to be unequal by this check, the value (not the key), is emitted
* and the selected key from that value is saved for future comparisons against other keys.
*
* ## Examples
*
* A very basic example with no `comparator`. Note that `1` is emitted more than once,
* A very basic example with no `{@link distinctUntilChanged#comparator comparator}`. Note that `1` is emitted more than once,
* because it's distinct in comparison to the _previously emitted_ value,

@@ -34,3 +53,3 @@ * not in comparison to _all other emitted values_.

*
* With a `comparator`, you can do custom comparisons. Let's say
* With a `{@link distinctUntilChanged#comparator comparator}`, you can do custom comparisons. Let's say
* you only want to emit a value when all of its components have

@@ -65,3 +84,3 @@ * changed:

*
* You can also provide a custom `comparator` to check that emitted
* You can also provide a custom `{@link distinctUntilChanged#comparator comparator}` to check that emitted
* changes are only in one direction. Let's say you only want to get

@@ -88,24 +107,4 @@ * the next record temperature:

*
* @param comparator A function used to compare the previous and current values for
* equality. Defaults to a `===` check.
* @return A function that returns an Observable that emits items from the
* source Observable with distinct values.
*/
export function distinctUntilChanged<T>(comparator?: (previous: T, current: T) => boolean): MonoTypeOperatorFunction<T>;
/**
* Returns a result {@link Observable} that emits all values pushed by the source observable if they
* are distinct in comparison to the last value the result observable emitted.
*
* 1. It will always emit the first value from the source.
* 2. The `keySelector` will be run against all values, including the first value.
* 3. For all values after the first, the selected key will be compared against the key selected from
* the previously emitted value using the `comparator`.
* 4. If the keys are determined to be unequal by this check, the value (not the key), is emitted
* and the selected key from that value is saved for future comparisons against other keys.
*
* ## Example
*
* Selecting update events only when the `updatedBy` field shows
* the account changed hands...
* the account changed hands.
*

@@ -136,5 +135,9 @@ * ```ts

*
* @see {@link distinct}
* @see {@link distinctUntilKeyChanged}
*
* @param comparator A function used to compare the previous and current keys for
* equality. Defaults to a `===` check.
* @param keySelector Used to select a key value to be passed to the `comparator`.
*
* @return A function that returns an Observable that emits items from the

@@ -144,7 +147,2 @@ * source Observable with distinct values.

export function distinctUntilChanged<T, K>(
comparator: (previous: K, current: K) => boolean,
keySelector: (value: T) => K
): MonoTypeOperatorFunction<T>;
export function distinctUntilChanged<T, K>(
comparator?: (previous: K, current: K) => boolean,

@@ -151,0 +149,0 @@ keySelector: (value: T) => K = identity as (value: T) => K

@@ -1,6 +0,4 @@

import { Subscription } from '../Subscription';
import { OperatorFunction, ObservableInput, ObservedValueOf } from '../types';
import { operate } from '../util/lift';
import { innerFrom } from '../observable/innerFrom';
import { createOperatorSubscriber } from './OperatorSubscriber';
import { exhaustMap } from './exhaustMap';
import { identity } from '../util/identity';

@@ -52,25 +50,3 @@ /**

export function exhaustAll<O extends ObservableInput<any>>(): OperatorFunction<O, ObservedValueOf<O>> {
return operate((source, subscriber) => {
let isComplete = false;
let innerSub: Subscription | null = null;
source.subscribe(
createOperatorSubscriber(
subscriber,
(inner) => {
if (!innerSub) {
innerSub = innerFrom(inner).subscribe(
createOperatorSubscriber(subscriber, undefined, () => {
innerSub = null;
isComplete && subscriber.complete();
})
);
}
},
() => {
isComplete = true;
!innerSub && subscriber.complete();
}
)
);
});
return exhaustMap(identity);
}

@@ -150,3 +150,3 @@ import { Observable } from '../Observable';

if (!elementOrOptions || typeof elementOrOptions === 'function') {
element = elementOrOptions;
element = elementOrOptions as ((value: any) => any);
} else {

@@ -153,0 +153,0 @@ ({ duration, element, connector } = elementOrOptions);

@@ -104,3 +104,3 @@ import { Observable } from '../Observable';

try {
nextSource = innerFrom<T | A[number]>(remaining.shift()!);
nextSource = innerFrom(remaining.shift()!);
} catch (err) {

@@ -107,0 +107,0 @@ subscribeNext();

@@ -5,4 +5,7 @@ import { map } from './map';

/* tslint:disable:max-line-length */
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<T, K1 extends keyof T>(k1: K1): OperatorFunction<T, T[K1]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<T, K1 extends keyof T, K2 extends keyof T[K1]>(k1: K1, k2: K2): OperatorFunction<T, T[K1][K2]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(

@@ -13,2 +16,3 @@ k1: K1,

): OperatorFunction<T, T[K1][K2][K3]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(

@@ -20,2 +24,3 @@ k1: K1,

): OperatorFunction<T, T[K1][K2][K3][K4]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<

@@ -29,2 +34,3 @@ T,

>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction<T, T[K1][K2][K3][K4][K5]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<

@@ -39,2 +45,3 @@ T,

>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction<T, T[K1][K2][K3][K4][K5][K6]>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<

@@ -49,2 +56,3 @@ T,

>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction<T, unknown>;
/** @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */
export function pluck<T>(...properties: string[]): OperatorFunction<T, unknown>;

@@ -51,0 +59,0 @@ /* tslint:enable:max-line-length */

@@ -89,3 +89,3 @@ import { MonoTypeOperatorFunction, ObservableInput } from '../types';

config = {
count: configOrCount,
count: configOrCount as number,
};

@@ -92,0 +92,0 @@ }

@@ -62,3 +62,3 @@ import { Observable } from '../Observable';

* Observable with the exception of an `error`.
* @deprecated: Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.
* @deprecated Will be removed in v9 or v10, use {@link retry}'s `delay` option instead.
*/

@@ -65,0 +65,0 @@ export function retryWhen<T>(notifier: (errors: Observable<any>) => Observable<any>): MonoTypeOperatorFunction<T> {

import { Observable } from '../Observable';
import { from } from '../observable/from';
import { take } from '../operators/take';
import { innerFrom } from '../observable/innerFrom';
import { Subject } from '../Subject';

@@ -156,5 +155,5 @@ import { SafeSubscriber } from '../Subscriber';

return (wrapperSource) => {
let connection: SafeSubscriber<T> | null = null;
let resetConnection: Subscription | null = null;
let subject: SubjectLike<T> | null = null;
let connection: SafeSubscriber<T> | undefined;
let resetConnection: Subscription | undefined;
let subject: SubjectLike<T> | undefined;
let refCount = 0;

@@ -166,3 +165,3 @@ let hasCompleted = false;

resetConnection?.unsubscribe();
resetConnection = null;
resetConnection = undefined;
};

@@ -173,3 +172,3 @@ // Used to reset the internal state to a "cold"

cancelReset();
connection = subject = null;
connection = subject = undefined;
hasCompleted = hasErrored = false;

@@ -217,3 +216,9 @@ };

if (!connection) {
if (
!connection &&
// Check this shareReplay is still activate - it can be reset to 0
// and be "unsubscribed" _before_ it actually subscribes.
// If we were to subscribe then, it'd leak and get stuck.
refCount > 0
) {
// We need to create a subscriber here - rather than pass an observer and

@@ -239,3 +244,3 @@ // assign the returned subscription to connection - because it's possible

});
from(source).subscribe(connection);
innerFrom(source).subscribe(connection);
}

@@ -250,16 +255,20 @@ })(wrapperSource);

...args: T
): Subscription | null {
): Subscription | undefined {
if (on === true) {
reset();
return null;
return;
}
if (on === false) {
return null;
return;
}
return on(...args)
.pipe(take(1))
.subscribe(() => reset());
const onSubscriber = new SafeSubscriber({
next: () => {
onSubscriber.unsubscribe();
reset();
},
});
return on(...args).subscribe(onSubscriber);
}

@@ -164,3 +164,3 @@ import { ReplaySubject } from '../ReplaySubject';

} else {
bufferSize = configOrBufferSize ?? Infinity;
bufferSize = (configOrBufferSize ?? Infinity) as number;
}

@@ -167,0 +167,0 @@ return share<T>({

@@ -5,3 +5,3 @@ import { switchMap } from './switchMap';

/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */
/** @deprecated Will be removed in v9. Use {@link switchMap} instead: `switchMap(() => result)` */
export function switchMapTo<O extends ObservableInput<unknown>>(observable: O): OperatorFunction<unknown, ObservedValueOf<O>>;

@@ -58,3 +58,3 @@ /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */

* Observable.
* @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)`
* @deprecated Will be removed in v9. Use {@link switchMap} instead: `switchMap(() => result)`
*/

@@ -61,0 +61,0 @@ export function switchMapTo<T, R, O extends ObservableInput<unknown>>(

import { Immediate } from '../util/Immediate';
import type { TimerHandle } from './timerHandle';
const { setImmediate, clearImmediate } = Immediate;
type SetImmediateFunction = (handler: () => void, ...args: any[]) => number;
type ClearImmediateFunction = (handle: number) => void;
type SetImmediateFunction = (handler: () => void, ...args: any[]) => TimerHandle;
type ClearImmediateFunction = (handle: TimerHandle) => void;

@@ -27,5 +28,5 @@ interface ImmediateProvider {

const { delegate } = immediateProvider;
return (delegate?.clearImmediate || clearImmediate)(handle);
return (delegate?.clearImmediate || clearImmediate)(handle as any);
},
delegate: undefined,
};

@@ -1,3 +0,4 @@

type SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;
type ClearIntervalFunction = (handle: number) => void;
import type { TimerHandle } from './timerHandle';
type SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;
type ClearIntervalFunction = (handle: TimerHandle) => void;

@@ -19,3 +20,3 @@ interface IntervalProvider {

setInterval(handler: () => void, timeout?: number, ...args) {
const {delegate} = intervalProvider;
const { delegate } = intervalProvider;
if (delegate?.setInterval) {

@@ -28,5 +29,5 @@ return delegate.setInterval(handler, timeout, ...args);

const { delegate } = intervalProvider;
return (delegate?.clearInterval || clearInterval)(handle);
return (delegate?.clearInterval || clearInterval)(handle as any);
},
delegate: undefined,
};

@@ -1,3 +0,4 @@

type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => number;
type ClearTimeoutFunction = (handle: number) => void;
import type { TimerHandle } from './timerHandle';
type SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;
type ClearTimeoutFunction = (handle: TimerHandle) => void;

@@ -19,3 +20,3 @@ interface TimeoutProvider {

setTimeout(handler: () => void, timeout?: number, ...args) {
const {delegate} = timeoutProvider;
const { delegate } = timeoutProvider;
if (delegate?.setTimeout) {

@@ -28,5 +29,5 @@ return delegate.setTimeout(handler, timeout, ...args);

const { delegate } = timeoutProvider;
return (delegate?.clearTimeout || clearTimeout)(handle);
return (delegate?.clearTimeout || clearTimeout)(handle as any);
},
delegate: undefined,
};

@@ -206,3 +206,3 @@ import { isFunction } from './util/isFunction';

partialObserver = {
next: observerOrNext ?? undefined,
next: (observerOrNext ?? undefined) as (((value: T) => void) | undefined),
error: error ?? undefined,

@@ -209,0 +209,0 @@ complete: complete ?? undefined,

@@ -13,2 +13,3 @@ import { Observable } from '../Observable';

import { animationFrameProvider } from '../scheduler/animationFrameProvider';
import type { TimerHandle } from '../scheduler/timerHandle';
import { immediateProvider } from '../scheduler/immediateProvider';

@@ -514,7 +515,7 @@ import { intervalProvider } from '../scheduler/intervalProvider';

const scheduleLookup = new Map<
number,
TimerHandle,
{
due: number;
duration: number;
handle: number;
handle: TimerHandle;
handler: () => void;

@@ -587,3 +588,3 @@ subscription: Subscription;

},
clearImmediate: (handle: number) => {
clearImmediate: (handle: TimerHandle) => {
const value = scheduleLookup.get(handle);

@@ -610,3 +611,3 @@ if (value) {

},
clearInterval: (handle: number) => {
clearInterval: (handle: TimerHandle) => {
const value = scheduleLookup.get(handle);

@@ -633,3 +634,3 @@ if (value) {

},
clearTimeout: (handle: number) => {
clearTimeout: (handle: TimerHandle) => {
const value = scheduleLookup.get(handle);

@@ -636,0 +637,0 @@ if (value) {

@@ -6,1 +6,3 @@ // Instead of using any - or another less-than-ideal type - to workaround a

// alongside the type alias.
export {}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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

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

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

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

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

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

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

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

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