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

Function isMinCodePoints

packages/effect/src/Schema.ts:8681–8696  ·  view source on GitHub ↗
(minCodePoints: number, annotations?: Annotations.Filter)

Source from the content-addressed store, hash-verified

8679 * @since 4.0.0
8680 */
8681export function isMinCodePoints(minCodePoints: number, annotations?: Annotations.Filter) {
8682 minCodePoints = normalizeCardinality(minCodePoints)
8683 return makeFilter<string>(
8684 (input) => countCodePointsUpTo(input, minCodePoints) >= minCodePoints,
8685 {
8686 expected: `a string with at least ${minCodePoints} code points`,
8687 representation: {
8688 id: "effect/schema/isMinCodePoints",
8689 payload: { minCodePoints }
8690 },
8691 toJsonSchema: () => ({ minLength: minCodePoints }),
8692 arbitraryConstraint: { minCodePoints },
8693 ...annotations
8694 }
8695 )
8696}
8697/**
8698 * Validates that a string contains at most the specified number of Unicode code points.
8699 *

Callers

nothing calls this directly

Calls 3

normalizeCardinalityFunction · 0.85
countCodePointsUpToFunction · 0.85
makeFilterFunction · 0.70

Tested by

no test coverage detected