(options: {
readonly order: Order.Order<T>
readonly annotate?: ((exclusiveMaximum: T) => Annotations.Filter) | undefined
readonly formatter?: Formatter<T> | undefined
})
| 7723 | * @since 4.0.0 |
| 7724 | */ |
| 7725 | export function makeIsLessThan<T>(options: { |
| 7726 | readonly order: Order.Order<T> |
| 7727 | readonly annotate?: ((exclusiveMaximum: T) => Annotations.Filter) | undefined |
| 7728 | readonly formatter?: Formatter<T> | undefined |
| 7729 | }) { |
| 7730 | const lt = Order.isLessThan(options.order) |
| 7731 | const formatter = options.formatter ?? format |
| 7732 | return (exclusiveMaximum: T, annotations?: Annotations.Filter) => { |
| 7733 | return makeFilter<T>( |
| 7734 | (input) => lt(input, exclusiveMaximum), |
| 7735 | { |
| 7736 | expected: `a value less than ${formatter(exclusiveMaximum)}`, |
| 7737 | arbitrary: { |
| 7738 | constraint: { |
| 7739 | ordered: { |
| 7740 | order: options.order, |
| 7741 | maximum: exclusiveMaximum, |
| 7742 | exclusiveMaximum: true |
| 7743 | } |
| 7744 | } |
| 7745 | }, |
| 7746 | ...options.annotate?.(exclusiveMaximum), |
| 7747 | ...annotations |
| 7748 | } |
| 7749 | ) |
| 7750 | } |
| 7751 | } |
| 7752 | |
| 7753 | /** |
| 7754 | * Creates a less-than-or-equal-to (`<=`) check for any ordered type from an |
no test coverage detected