(options: {
readonly order: Order.Order<T>
readonly annotate?: ((exclusiveMaximum: T) => Annotations.Filter) | undefined
readonly formatter?: Formatter<T> | undefined
})
| 7624 | * @since 4.0.0 |
| 7625 | */ |
| 7626 | export function makeIsLessThan<T>(options: { |
| 7627 | readonly order: Order.Order<T> |
| 7628 | readonly annotate?: ((exclusiveMaximum: T) => Annotations.Filter) | undefined |
| 7629 | readonly formatter?: Formatter<T> | undefined |
| 7630 | }) { |
| 7631 | const lt = Order.isLessThan(options.order) |
| 7632 | const formatter = options.formatter ?? format |
| 7633 | return (exclusiveMaximum: T, annotations?: Annotations.Filter) => { |
| 7634 | return makeFilter<T>( |
| 7635 | (input) => lt(input, exclusiveMaximum), |
| 7636 | { |
| 7637 | expected: `a value less than ${formatter(exclusiveMaximum)}`, |
| 7638 | arbitraryConstraint: { |
| 7639 | order: options.order, |
| 7640 | maximum: exclusiveMaximum, |
| 7641 | exclusiveMaximum: true |
| 7642 | }, |
| 7643 | ...options.annotate?.(exclusiveMaximum), |
| 7644 | ...annotations |
| 7645 | } |
| 7646 | ) |
| 7647 | } |
| 7648 | } |
| 7649 | /** |
| 7650 | * Creates a less-than-or-equal-to (`<=`) check for any ordered type from an |
| 7651 | * `Order.Order` instance. |
no test coverage detected