Function minItem

Returns the minimum item from the given array.

  • If the array is empty, returns undefined.
  • If the array contains numbers, returns the minimum number.
  • If the array contains strings, returns the string with the lowest lexicographical order.
  • Type Parameters

    • S extends readonly number[] | readonly string[]

      The type of the array.

    Parameters

    • source: S

      The array from which to find the minimum item.

    Returns ExtractItem<S>

    The minimum item from the array, or undefined if the array is empty.