Sanitizes a numeric input by ensuring it is valid and falls back to a default value if not.

  • Parameters

    • input: {
          defaultValue: number;
          excludeZero?: boolean;
          inputLabel: string;
          inputValue?: number;
      }

      An object containing the input properties.

      • defaultValue: number

        The default value to return if the input is invalid.

      • OptionalexcludeZero?: boolean

        Whether to include 0 as valid input value or not (default is false)

      • inputLabel: string

        A label describing the input (used in warnings).

      • OptionalinputValue?: number

        The numeric value to sanitize (optional).

    Returns number

    A valid number. Either the provided inputValue if valid, or the defaultValue.