UNPKG

sequency

Version:

Functional sequences for processing iterable data in JavaScript

24 lines 741 B
Object.defineProperty(exports, "__esModule", { value: true }); exports.MinWith = void 0; var MinWith = /** @class */ (function () { function MinWith() { } /** * Returns the minimum element of the sequence by evaluating the given `compare` * function or `null` if sequence is empty. * * @returns {T} */ MinWith.prototype.minWith = function (compare) { var min = null; for (var item = this.iterator.next(); !item.done; item = this.iterator.next()) { if (min == null || compare(item.value, min) < 0) { min = item.value; } } return min; }; return MinWith; }()); exports.MinWith = MinWith; //# sourceMappingURL=minWith.js.map