source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/first.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 591 bytes
Line 
1import { EmptyError } from '../util/EmptyError';
2import { filter } from './filter';
3import { take } from './take';
4import { defaultIfEmpty } from './defaultIfEmpty';
5import { throwIfEmpty } from './throwIfEmpty';
6import { identity } from '../util/identity';
7export function first(predicate, defaultValue) {
8 const hasDefaultValue = arguments.length >= 2;
9 return (source) => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));
10}
11//# sourceMappingURL=first.js.map
Note: See TracBrowser for help on using the repository browser.