UNPKG

typedash

Version:

modern, type-safe collection of utility functions

18 lines (15 loc) 789 B
import { M as Maybe } from '../Maybe-D6dwMjD9.js'; /** * Computes the maximum value of array. If array is empty or nil, `undefined` is returned. * @param array The array to iterate over. * @returns The maximum value in the array, or `undefined` if the array is empty or nil. */ declare function max<T>(array: Maybe<readonly T[]>): number; /** * Computes the maximum value of array. If array is empty or nil, `undefined` is returned. * @param array The array to iterate over. * @param valueExtractor An optional function used to extract a numeric value from each element. * @returns The maximum value in the array, or `undefined` if the array is empty or nil. */ declare function max<T>(array: Maybe<readonly T[]>, valueExtractor?: (value: T) => number): number; export { max };