Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
56 lines (43 loc) · 2.14 KB

maxby.md

File metadata and controls

56 lines (43 loc) · 2.14 KB

Rx.Observable.prototype.maxBy(keySelector, [comparer])

Returns the maximum value in an observable sequence according to the specified comparer.

Arguments

  1. keySelector (Function): Key selector function.
  2. [comparer] (Function): Comparer used to compare elements.

Returns

(Observable): An observable sequence containing a list of zero or more elements that have a maximum key value.

Example

/* Without comparer */
var source = Rx.Observable.from([1,3,5,7,9,2,4,6,8,9])
    .maxBy(function (x) { return x; });

var subscription = source.subscribe(
    function (x) {
        console.log('Next: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Next: 9,9
// => Completed

Location

File:

Dist:

Prerequisites:

NPM Packages:

NuGet Packages:

Unit Tests: