@ngrx/core
Version:
Core operators and utiliies for the ngrx platform
22 lines • 809 B
JavaScript
import { pluck } from 'rxjs/operator/pluck';
import { map } from 'rxjs/operator/map';
import { distinctUntilChanged } from 'rxjs/operator/distinctUntilChanged';
export function select(pathOrMapFn) {
var paths = [];
for (var _i = 1; _i < arguments.length; _i++) {
paths[_i - 1] = arguments[_i];
}
var mapped$;
if (typeof pathOrMapFn === 'string') {
mapped$ = pluck.call.apply(pluck, [this, pathOrMapFn].concat(paths));
}
else if (typeof pathOrMapFn === 'function') {
mapped$ = map.call(this, pathOrMapFn);
}
else {
throw new TypeError(("Unexpected type " + typeof pathOrMapFn + " in select operator,")
+ " expected 'string' or 'function'");
}
return distinctUntilChanged.call(mapped$);
}
//# sourceMappingURL=select.js.map