Skip to main content

IntegerOptions

Index

Properties

optionalarbitrary

arbitrary?: Partial<IntegerGenerator>

optionalmax

max?: number

A number is valid if the value is lower than or equal to the parameter.

@example
Given `$integer({maximum: 1.0})`

- input: 1 (validates)
- input: 2 (invalid)

maxInclusive

maxInclusive: boolean

optionalmin

min?: number

A number is valid if the value is greater than or equal to the parameter.

@example
Given `$integer({minimum: 1.0})`

- input: 0 (invalid)
- input: 1 (validates)

minInclusive

minInclusive: boolean

optionalmultipleOf

multipleOf?: number

The resulting property will only be valid when the value divided by this parameter results in a strict integer. (exluding zero)

@example
Given `$integer({multipleOf: 0.2})`

- input: 10 -> 10 / 0.2 = 50 (validates)
- input: 10.5 -> 10.5 / 0.2 = 52.5 (invalid)