ts-iterable-functions
    Preparing search index...

    Function _max

    • Computes the maximum value from the source iterable using an optional projection and comparer.

      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.

      Returns TOut | undefined

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

      Error Rethrows any error thrown by selector or comparer.

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

      or using the curried version:

      const result = pipeInto(
      [
      { value: 3 },
      { value: 7 },
      { value: 4 },
      ],
      max((item) => item.value)
      );
      console.log(result); // 7