Skip to main content

NumberOptions

Index

Properties

optionalarbitrary

arbitrary?: Partial<FloatGenerator>

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)

optionalmaxInclusive

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)

optionalminInclusive

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)