Skip to content

Commit

Permalink
fix(take): complete on limit reached
Browse files Browse the repository at this point in the history
  • Loading branch information
jinroh authored and benlesh committed Aug 27, 2015
1 parent 9f8347f commit 801a711
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/operators/take.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ export class TakeSubscriber<T> extends Subscriber<T> {
}

_next(x) {
if (++this.count <= this.total) {
const total = this.total;
if (++this.count <= total) {
this.destination.next(x);
} else {
this.destination.complete();
if (this.count === total) {
this.destination.complete();
}
}
}
}

0 comments on commit 801a711

Please sign in to comment.