• Returns the largest value in an array of Big numbers

    Parameters

    • data: Big[]

      Array of Big numbers to find maximum from

    Returns Big

    The maximum value in the array

    If array is empty

    const numbers = [
    new Big('10.5'),
    new Big('2.3'),
    new Big('15.7')
    ];

    const maximum = max(numbers); // Returns Big('15.7')
    • Accepts a standard array for better ergonomics, with runtime validation ensuring non-emptiness
    • Single-pass implementation using reduce for efficiency
    • While the function could use NonEmptyArray, we prefer accepting standard arrays to improve usability since runtime validation is required regardless