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.

first.js 814B

1234567891011121314
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var EmptyError_1 = require("../util/EmptyError");
  4. var filter_1 = require("./filter");
  5. var take_1 = require("./take");
  6. var defaultIfEmpty_1 = require("./defaultIfEmpty");
  7. var throwIfEmpty_1 = require("./throwIfEmpty");
  8. var identity_1 = require("../util/identity");
  9. function first(predicate, defaultValue) {
  10. var hasDefaultValue = arguments.length >= 2;
  11. return function (source) { return source.pipe(predicate ? filter_1.filter(function (v, i) { return predicate(v, i, source); }) : identity_1.identity, take_1.take(1), hasDefaultValue ? defaultIfEmpty_1.defaultIfEmpty(defaultValue) : throwIfEmpty_1.throwIfEmpty(function () { return new EmptyError_1.EmptyError(); })); };
  12. }
  13. exports.first = first;
  14. //# sourceMappingURL=first.js.map