Function convertNumber

  • Converts a number or a string representation of a number into a number type. This function is useful for ensuring that the input is in a consistent numeric format, which can help prevent type mismatches in further processing.

    Parameters

    Returns number | undefined

    Returns the converted number if the input is valid; otherwise, it returns undefined.