From 801a711f2f1e4a1c4e327bc3b63603e26042926a Mon Sep 17 00:00:00 2001 From: Pierre Guilleminot Date: Thu, 27 Aug 2015 17:28:25 +0200 Subject: [PATCH] fix(take): complete on limit reached --- src/operators/take.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/operators/take.ts b/src/operators/take.ts index c0ed065a55..38bf60eb56 100644 --- a/src/operators/take.ts +++ b/src/operators/take.ts @@ -30,10 +30,12 @@ export class TakeSubscriber extends Subscriber { } _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(); + } } } }