Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
832 bytes
|
Line | |
---|
1 | /** PURE_IMPORTS_START _util_ArgumentOutOfRangeError,_filter,_throwIfEmpty,_defaultIfEmpty,_take PURE_IMPORTS_END */
|
---|
2 | import { ArgumentOutOfRangeError } from '../util/ArgumentOutOfRangeError';
|
---|
3 | import { filter } from './filter';
|
---|
4 | import { throwIfEmpty } from './throwIfEmpty';
|
---|
5 | import { defaultIfEmpty } from './defaultIfEmpty';
|
---|
6 | import { take } from './take';
|
---|
7 | export function elementAt(index, defaultValue) {
|
---|
8 | if (index < 0) {
|
---|
9 | throw new ArgumentOutOfRangeError();
|
---|
10 | }
|
---|
11 | var hasDefaultValue = arguments.length >= 2;
|
---|
12 | return function (source) {
|
---|
13 | return source.pipe(filter(function (v, i) { return i === index; }), take(1), hasDefaultValue
|
---|
14 | ? defaultIfEmpty(defaultValue)
|
---|
15 | : throwIfEmpty(function () { return new ArgumentOutOfRangeError(); }));
|
---|
16 | };
|
---|
17 | }
|
---|
18 | //# sourceMappingURL=elementAt.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.