Skip to content

Commit

Permalink
perf(count): fast-path for counting over scalars
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Oct 14, 2015
1 parent 86a9b45 commit c35a120
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/observables/ScalarObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,8 @@ export default class ScalarObservable<T> extends Observable<T> {
scan<R>(project: (acc: R, x: T) => R, acc?: R): Observable<R> {
return this.reduce(project, acc);
}

count(): Observable<number> {
return new ScalarObservable(1);
}
}

0 comments on commit c35a120

Please sign in to comment.