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

Function withArrayLengthConstraints

packages/effect/src/Schema.ts:4732–4743  ·  view source on GitHub ↗
(
  self: $Array<Item>,
  minimum: number | undefined,
  maximum: number | undefined
)

Source from the content-addressed store, hash-verified

4730
4731/** @internal */
4732export function withArrayLengthConstraints<Item extends Constraint>(
4733 self: $Array<Item>,
4734 minimum: number | undefined,
4735 maximum: number | undefined
4736): $Array<Item> {
4737 if (minimum !== undefined && maximum !== undefined) {
4738 return self.check(isBetweenLength(minimum, maximum))
4739 }
4740 if (minimum !== undefined) return self.check(isMinLength(minimum))
4741 if (maximum !== undefined) return self.check(isMaxLength(maximum))
4742 return self
4743}
4744/**
4745 * Type-level representation returned by {@link NonEmptyArray}.
4746 *

Callers 3

ChunkFunction · 0.85
HashMapFunction · 0.85
HashSetFunction · 0.85

Calls 4

isBetweenLengthFunction · 0.85
isMinLengthFunction · 0.85
isMaxLengthFunction · 0.85
checkMethod · 0.65

Tested by

no test coverage detected