1 | import { pluck } from 'rxjs/operator/pluck';
|
2 | import { map } from 'rxjs/operator/map';
|
3 | import { distinctUntilChanged } from 'rxjs/operator/distinctUntilChanged';
|
4 | export function select(pathOrMapFn) {
|
5 | var paths = [];
|
6 | for (var _i = 1; _i < arguments.length; _i++) {
|
7 | paths[_i - 1] = arguments[_i];
|
8 | }
|
9 | var mapped$;
|
10 | if (typeof pathOrMapFn === 'string') {
|
11 | mapped$ = pluck.call.apply(pluck, [this, pathOrMapFn].concat(paths));
|
12 | }
|
13 | else if (typeof pathOrMapFn === 'function') {
|
14 | mapped$ = map.call(this, pathOrMapFn);
|
15 | }
|
16 | else {
|
17 | throw new TypeError(("Unexpected type " + typeof pathOrMapFn + " in select operator,")
|
18 | + " expected 'string' or 'function'");
|
19 | }
|
20 | return distinctUntilChanged.call(mapped$);
|
21 | }
|
22 |
|
\ | No newline at end of file |