ts-iterable-functions
    Preparing search index...

    Function _min

    • Computes the minimum projected value from the source iterable.

      Type Parameters

      • T

        Element type produced by the source iterable.

      • TOut = T

        Element type produced by the selector and consumed by the comparer.

      Parameters

      • src: Iterable<T>

        Source iterable to evaluate.

      • selector: IndexedSelector<T, TOut> = ...

        Selector receiving each element and its index, producing the value to compare.

      • comparer: Comparer<TOut> = defaultComparer

        Comparer determining ordering between projected values; defaults to defaultComparer.

      Returns TOut | undefined

      The smallest projected value, or undefined when the source is empty.

      Error Rethrows any error thrown by selector or comparer.

      const smallest = _min([3, 1, 5, 2]);
      console.log(smallest); // 1

      or using the curried version:

      const lowestPrice = pipeInto(
      [
      { id: 1, price: 12 },
      { id: 2, price: 8 },
      { id: 3, price: 15 },
      ],
      min((item) => item.price)
      );
      console.log(lowestPrice); // 8