Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

elementAt.js 901B

123456789101112131415161718
  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