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

Function makeIsLessThan

packages/effect/src/Schema.ts:7725–7751  ·  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

7723 * @since 4.0.0
7724 */
7725export 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

Callers 1

Schema.tsFile · 0.85

Calls 3

makeFilterFunction · 0.85
ltFunction · 0.85
annotateMethod · 0.65

Tested by

no test coverage detected