From c35a120a738fdefa9157924a6f8d7a5990a61edc Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Tue, 13 Oct 2015 16:34:17 -0700 Subject: [PATCH] perf(count): fast-path for counting over scalars --- src/observables/ScalarObservable.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/observables/ScalarObservable.ts b/src/observables/ScalarObservable.ts index b591af8f46..09dde2d982 100644 --- a/src/observables/ScalarObservable.ts +++ b/src/observables/ScalarObservable.ts @@ -89,4 +89,8 @@ export default class ScalarObservable extends Observable { scan(project: (acc: R, x: T) => R, acc?: R): Observable { return this.reduce(project, acc); } + + count(): Observable { + return new ScalarObservable(1); + } }