From f6bd51fbe8e04c68065a4da60d84a98a7082ed3d Mon Sep 17 00:00:00 2001 From: Jason Aden Date: Fri, 8 Sep 2017 07:48:03 -0700 Subject: [PATCH] feat(zipAll): add higher-order lettable version of zipAll --- src/operator/zipAll.ts | 4 ++-- src/operators/index.ts | 1 + src/operators/zipAll.ts | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 src/operators/zipAll.ts diff --git a/src/operator/zipAll.ts b/src/operator/zipAll.ts index 2411dbb574..22bc2e7671 100644 --- a/src/operator/zipAll.ts +++ b/src/operator/zipAll.ts @@ -1,5 +1,5 @@ -import { ZipOperator } from '../operators/zip'; import { Observable } from '../Observable'; +import { zipAll as higherOrder } from '../operators/zipAll'; /** * @param project @@ -8,5 +8,5 @@ import { Observable } from '../Observable'; * @owner Observable */ export function zipAll(this: Observable, project?: (...values: Array) => R): Observable { - return this.lift(new ZipOperator(project)); + return higherOrder(project)(this); } diff --git a/src/operators/index.ts b/src/operators/index.ts index 5b8f1b1a23..6e2274a40f 100644 --- a/src/operators/index.ts +++ b/src/operators/index.ts @@ -80,3 +80,4 @@ export { windowToggle } from './windowToggle'; export { windowWhen } from './windowWhen'; export { withLatestFrom } from './withLatestFrom'; export { zip } from './zip'; +export { zipAll } from './zipAll'; diff --git a/src/operators/zipAll.ts b/src/operators/zipAll.ts new file mode 100644 index 0000000000..a1bb2e465d --- /dev/null +++ b/src/operators/zipAll.ts @@ -0,0 +1,7 @@ +import { ZipOperator } from './zip'; +import { Observable } from '../Observable'; +import { OperatorFunction } from '../interfaces'; + +export function zipAll(project?: (...values: Array) => R): OperatorFunction { + return (source: Observable) => source.lift(new ZipOperator(project)); +}