(
divisor: number,
annotations?: Annotations.Filter
): SchemaAST.Filter<number>Validates that a number is a multiple of the specified divisor.
Details
JSON Schema:
This check corresponds to the multipleOf constraint in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies constraints to ensure generated numbers are multiples of the specified divisor.
export const const isMultipleOf: (
divisor: unknown,
annotations?: Annotations.Filter
) => SchemaAST.Filter<unknown>
Validates that a number is a multiple of the specified divisor.
Details
JSON Schema:
This check corresponds to the multipleOf constraint in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies constraints to ensure
generated numbers are multiples of the specified divisor.
isMultipleOf = function makeIsMultipleOf<T>(options: {
readonly remainder: (input: T, divisor: T) => T
readonly zero: NoInfer<T>
readonly annotate?:
| ((divisor: T) => Annotations.Filter)
| undefined
readonly formatter?: Formatter<T> | undefined
}): (
divisor: T,
annotations?: Annotations.Filter
) => SchemaAST.Filter<T>
Creates a divisibility check for any numeric type from a remainder function
and a zero value.
makeIsMultipleOf({
remainder: (
input: unknown,
divisor: unknown
) => unknown
remainder,
zero: unknownzero: 0,
annotate?: | ((divisor: unknown) => Annotations.Filter)
| undefined
annotate: (divisor: unknowndivisor) => ({
Annotations.Augment.expected?: string | undefinedHuman-readable description of what a value is expected to satisfy.
Details
For filter and refinement failures, the default formatter uses
message first, then expected, and finally falls back to <filter>.
Use this to name a failed filter in the default message:
Expected <expected>, got <actual>.
expected: `a value that is a multiple of ${divisor: unknowndivisor}`,
Annotations.Filter.meta?: Annotations.Meta | undefined(property) Annotations.Filter.meta?: {
_tag: 'isMultipleOf';
divisor: number;
}
Optional metadata used to identify or extend the filter with custom data.
meta: {
_tag: "isMultipleOf"_tag: "isMultipleOf",
divisor: numberdivisor
}
})
})