(
exclusiveMaximum: number,
annotations?: Annotations.Filter
): SchemaAST.Filter<number>Validates that a number is less than the specified value (exclusive).
Details
JSON Schema:
This check corresponds to the exclusiveMaximum constraint in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies an
exclusiveMaximum constraint to ensure generated numbers are less than the
specified value.
export const const isLessThan: (
exclusiveMaximum: number,
annotations?: Annotations.Filter
) => SchemaAST.Filter<number>
Validates that a number is less than the specified value (exclusive).
Details
JSON Schema:
This check corresponds to the exclusiveMaximum constraint in JSON Schema.
Arbitrary:
When generating test data with fast-check, this applies an
exclusiveMaximum constraint to ensure generated numbers are less than the
specified value.
isLessThan = function makeIsLessThan<T>(options: {
readonly order: Order.Order<T>
readonly annotate?:
| ((
exclusiveMaximum: T
) => Annotations.Filter)
| undefined
readonly formatter?: Formatter<T> | undefined
}): (
exclusiveMaximum: T,
annotations?: Annotations.Filter
) => SchemaAST.Filter<T>
Creates a less-than (<) check for any ordered type from an Order.Order
instance.
makeIsLessThan({
order: Order.Order<number>order: import OrderOrder.const Number: Order<number>Order instance for numbers that compares them numerically.
When to use
Use when you need numeric ordering for numbers.
Details
0 is considered equal to -0. All NaN values are considered equal to
each other, and any NaN is considered less than any non-NaN number. All
other values use standard numeric comparison.
Example (Ordering numbers)
import { Order } from "effect"
console.log(Order.Number(1, 1)) // 0
console.log(Order.Number(1, 2)) // -1
console.log(Order.Number(2, 1)) // 1
console.log(Order.Number(0, -0)) // 0
console.log(Order.Number(NaN, 1)) // -1
Number,
annotate?: | ((
exclusiveMaximum: number
) => Annotations.Filter)
| undefined
annotate: (exclusiveMaximum: numberexclusiveMaximum) => ({
Annotations.Filter.meta?: Annotations.Meta | undefined(property) Annotations.Filter.meta?: {
_tag: 'isLessThan';
exclusiveMaximum: number;
}
Optional metadata used to identify or extend the filter with custom data.
meta: {
_tag: "isLessThan"_tag: "isLessThan",
exclusiveMaximum: numberexclusiveMaximum
}
})
})