Skip to content

Commit 68ee499

Browse files
committed
refactor(distinct): Remove Set polyfill
BREAKING CHANGE: Using `distinct` requires a `Set` implementation and must be polyfilled in older runtimes
1 parent 5eb6af7 commit 68ee499

File tree

4 files changed

+5
-111
lines changed

4 files changed

+5
-111
lines changed

spec/util/Set-spec.ts

Lines changed: 0 additions & 60 deletions
This file was deleted.

spec/util/root-spec.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/operators/distinct.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import { TeardownLogic } from '../Subscription';
55
import { OuterSubscriber } from '../OuterSubscriber';
66
import { InnerSubscriber } from '../InnerSubscriber';
77
import { subscribeToResult } from '../util/subscribeToResult';
8-
import { ISet, Set } from '../util/Set';
98
import { MonoTypeOperatorFunction } from '../interfaces';
109

10+
if (!Set) {
11+
throw new Error('Set is not present, please polyfill');
12+
}
13+
1114
/**
1215
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
1316
*
@@ -73,7 +76,7 @@ class DistinctOperator<T, K> implements Operator<T, T> {
7376
* @extends {Ignored}
7477
*/
7578
export class DistinctSubscriber<T, K> extends OuterSubscriber<T, T> {
76-
private values: ISet<K> = new Set<K>();
79+
private values = new Set<K>();
7780

7881
constructor(destination: Subscriber<T>, private keySelector: (value: T) => K, flushes: Observable<any>) {
7982
super(destination);

src/util/Set.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)