SOUTHERNCO\x2mjbyrn 7efe7605b8 Template Upload
2017-05-17 13:45:25 -04:00

20 lines
772 B
JavaScript

"use strict";
var reduce_1 = require('./reduce');
/**
* The Max operator operates on an Observable that emits numbers (or items that can be evaluated as numbers),
* and when source Observable completes it emits a single item: the item with the largest number.
*
* <img src="./img/max.png" width="100%">
*
* @param {Function} optional comparer function that it will use instead of its default to compare the value of two
* items.
* @returns {Observable} an Observable that emits item with the largest number.
*/
function max(comparer) {
var max = (typeof comparer === 'function')
? comparer
: function (x, y) { return x > y ? x : y; };
return this.lift(new reduce_1.ReduceOperator(max));
}
exports.max = max;
//# sourceMappingURL=max.js.map