Hex Core JS
    Preparing search index...

    Function unitValidator

    • Returns a validation function to validate that a number meets a unit requirement (value is divisible by the unit), if given. The unit is generally a power of ten, but need not be.

      Parameters

      • Optionalunit: number

        The unit that the value must be divisible by.

      • OptionalerrorMessage: string

        A custom error message to display if the value is invalid.

      Returns SyncValidationFunction<number | null>

      Unit here should not be confused with the unit prop on the <NumberInput> and <NumberField> components. This function validates that a value is evenly divsible by the given unit. This unit can be interpreted as precision when unit is a power of ten.

      Null values count as valid.