source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/elementAt.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: 642 bytes
Line 
1import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
2import { filter } from './filter';
3import { throwIfEmpty } from './throwIfEmpty';
4import { defaultIfEmpty } from './defaultIfEmpty';
5import { take } from './take';
6export function elementAt(index, defaultValue) {
7 if (index < 0) {
8 throw new ArgumentOutOfRangeError();
9 }
10 const hasDefaultValue = arguments.length >= 2;
11 return (source) => source.pipe(filter((v, i) => i === index), take(1), hasDefaultValue
12 ? defaultIfEmpty(defaultValue)
13 : throwIfEmpty(() => new ArgumentOutOfRangeError()));
14}
15//# sourceMappingURL=elementAt.js.map
Note: See TracBrowser for help on using the repository browser.