• Returns the minimum seen of an iterable as it changes. Streaming result: works with endless iterables.

    Note that gt function returns true if A is greater than B, even though we're looking for the minimum.

    // Rank objects based on 'v' value
    const rank = (a,b) => a.v > b.v;
    min([
    {i:0,v:1},
    {i:1,v:9},
    {i:2,v:-2}
    ], rank);
    // Yields: {i:2, v:1}, {i:2,v:-2}

    Type Parameters

    • V

    Parameters

    • it: AsyncIterable<V>

      Iterable

    • gt: ((a: V, b: V) => boolean) = ...

      Should return true if a is greater than b.

        • (a, b): boolean
        • Parameters

          Returns boolean

    Returns AsyncGenerator<Awaited<V>, undefined | Awaited<V>, unknown>