Skip to content

Commit

Permalink
feat(combineAll): add higher-order lettable version of combineAll
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Sep 4, 2017
1 parent b7154f2 commit 97704b3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/operator/combineAll.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CombineLatestOperator } from '../operators/combineLatest';

import { Observable } from '../Observable';
import { combineAll as higherOrder } from '../operators';

/**
* Converts a higher-order Observable into a first-order Observable by waiting
Expand Down Expand Up @@ -42,5 +43,5 @@ import { Observable } from '../Observable';
* @owner Observable
*/
export function combineAll<T, R>(this: Observable<T>, project?: (...values: Array<any>) => R): Observable<R> {
return this.lift(new CombineLatestOperator(project));
return higherOrder(project)(this);
}
7 changes: 7 additions & 0 deletions src/operators/combineAll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { CombineLatestOperator } from '../operators/combineLatest';
import { Observable } from '../Observable';
import { OperatorFunction } from '../interfaces';

export function combineAll<T, R>(project?: (...values: Array<any>) => R): OperatorFunction<T, R> {
return (source: Observable<T>) => source.lift(new CombineLatestOperator(project));
}
1 change: 1 addition & 0 deletions src/operators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { bufferTime } from './bufferTime';
export { bufferToggle } from './bufferToggle';
export { bufferWhen } from './bufferWhen';
export { catchError } from './catchError';
export { combineAll } from './combineAll';
export { combineLatest } from './combineLatest';
export { concat } from './concat';
export { concatAll } from './concatAll';
Expand Down

0 comments on commit 97704b3

Please sign in to comment.