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

Function isBetweenSize

packages/effect/src/Schema.ts:8897–8920  ·  view source on GitHub ↗
(minimum: number, maximum: number, annotations?: Annotations.Filter)

Source from the content-addressed store, hash-verified

8895 * @since 4.0.0
8896 */
8897export function isBetweenSize(minimum: number, maximum: number, annotations?: Annotations.Filter) {
8898 minimum = normalizeCardinality(minimum)
8899 maximum = normalizeCardinality(maximum)
8900 return makeFilter<{ readonly size: number }>(
8901 (input) => input.size >= minimum && input.size <= maximum,
8902 {
8903 expected: minimum === maximum
8904 ? `a value with a size of ${minimum}`
8905 : `a value with a size between ${minimum} and ${maximum}`,
8906
8907 representation: {
8908 id: "effect/schema/isBetweenSize",
8909 payload: { minimum, maximum }
8910 },
8911 toJsonSchema: () => [{}, true],
8912 [InternalAnnotations.STRUCTURAL_ANNOTATION_KEY]: true,
8913 arbitraryConstraint: {
8914 minSize: minimum,
8915 maxSize: maximum
8916 },
8917 ...annotations
8918 }
8919 )
8920}
8921/**
8922 * Validates that an object contains at least the specified number of
8923 * own enumerable properties, including both string and symbol keys.

Callers

nothing calls this directly

Calls 2

normalizeCardinalityFunction · 0.85
makeFilterFunction · 0.70

Tested by

no test coverage detected