Function max

Returns the maximum value of an iterable as it changes. Streaming result: works with endless iterables.

// Rank values by their 'v' field
const rank = (a,b) => a.v > b.v;

min([
{i:0,v:1},
{i:1,v:9},
{i:2,v:-2}
], rank);
// Yields: {i:0,v:1}, {i:1,v:9}

Iterable

Should return true if a is greater than b.

Iterable of maximum values

  • Type Parameters

    • V

    Parameters

    • it: AsyncIterable<V>
    • Optionalgt: ((a: V, b: V) => boolean)
        • (a, b): boolean
        • Parameters

          Returns boolean

    Returns AsyncGenerator<V>

  • Type Parameters

    • V

    Parameters

    • it: Iterable<V>
    • Optionalgt: ((a: V, b: V) => boolean)
        • (a, b): boolean
        • Parameters

          Returns boolean

    Returns Generator<V>