Function minBy

  • Returns the element in the source that has the minimum value according to the comparer.

    Type Parameters

    • T

      Type of items in the source.

    Parameters

    Returns CollectorFunction<T, T | undefined>

    Collector that returns the element in the source that has the minimum value according to the comparer.

    const result = minBy<number>((a, b) => a - b)([1, 2, 3]);
    console.log(result); // 1