Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
900 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var ArgumentOutOfRangeError_1 = require("../util/ArgumentOutOfRangeError");
|
---|
4 | var filter_1 = require("./filter");
|
---|
5 | var throwIfEmpty_1 = require("./throwIfEmpty");
|
---|
6 | var defaultIfEmpty_1 = require("./defaultIfEmpty");
|
---|
7 | var take_1 = require("./take");
|
---|
8 | function elementAt(index, defaultValue) {
|
---|
9 | if (index < 0) {
|
---|
10 | throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError();
|
---|
11 | }
|
---|
12 | var hasDefaultValue = arguments.length >= 2;
|
---|
13 | return function (source) { return source.pipe(filter_1.filter(function (v, i) { return i === index; }), take_1.take(1), hasDefaultValue
|
---|
14 | ? defaultIfEmpty_1.defaultIfEmpty(defaultValue)
|
---|
15 | : throwIfEmpty_1.throwIfEmpty(function () { return new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError(); })); };
|
---|
16 | }
|
---|
17 | exports.elementAt = elementAt;
|
---|
18 | //# sourceMappingURL=elementAt.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.