MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeIsLessThan

Function makeIsLessThan

packages/effect/src/Schema.ts:7626–7648  ·  view source on GitHub ↗
(options: {
  readonly order: Order.Order<T>
  readonly annotate?: ((exclusiveMaximum: T) => Annotations.Filter) | undefined
  readonly formatter?: Formatter<T> | undefined
})

Source from the content-addressed store, hash-verified

7624 * @since 4.0.0
7625 */
7626export 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.

Callers 1

Schema.tsFile · 0.85

Calls 3

ltFunction · 0.85
makeFilterFunction · 0.70
annotateMethod · 0.65

Tested by

no test coverage detected