Skip to content

Commit

Permalink
refactor(distinct): Remove Set polyfill
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Using `distinct` requires a `Set` implementation and must be polyfilled in older runtimes
  • Loading branch information
benlesh committed Nov 3, 2017
1 parent 5eb6af7 commit 68ee499
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 111 deletions.
60 changes: 0 additions & 60 deletions spec/util/Set-spec.ts

This file was deleted.

9 changes: 0 additions & 9 deletions spec/util/root-spec.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/operators/distinct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { TeardownLogic } from '../Subscription';
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
import { ISet, Set } from '../util/Set';
import { MonoTypeOperatorFunction } from '../interfaces';

if (!Set) {
throw new Error('Set is not present, please polyfill');
}

/**
* Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items.
*
Expand Down Expand Up @@ -73,7 +76,7 @@ class DistinctOperator<T, K> implements Operator<T, T> {
* @extends {Ignored}
*/
export class DistinctSubscriber<T, K> extends OuterSubscriber<T, T> {
private values: ISet<K> = new Set<K>();
private values = new Set<K>();

constructor(destination: Subscriber<T>, private keySelector: (value: T) => K, flushes: Observable<any>) {
super(destination);
Expand Down
40 changes: 0 additions & 40 deletions src/util/Set.ts

This file was deleted.

0 comments on commit 68ee499

Please sign in to comment.