(maxCodePoints: number, annotations?: Annotations.Filter)
| 8717 | * @since 4.0.0 |
| 8718 | */ |
| 8719 | export function isMaxCodePoints(maxCodePoints: number, annotations?: Annotations.Filter) { |
| 8720 | maxCodePoints = normalizeCardinality(maxCodePoints) |
| 8721 | return makeFilter<string>( |
| 8722 | (input) => countCodePointsUpTo(input, maxCodePoints + 1) <= maxCodePoints, |
| 8723 | { |
| 8724 | expected: `a string with at most ${maxCodePoints} code points`, |
| 8725 | representation: { |
| 8726 | id: "effect/schema/isMaxCodePoints", |
| 8727 | payload: { maxCodePoints } |
| 8728 | }, |
| 8729 | toJsonSchema: () => ({ maxLength: maxCodePoints }), |
| 8730 | arbitraryConstraint: { maxCodePoints }, |
| 8731 | ...annotations |
| 8732 | } |
| 8733 | ) |
| 8734 | } |
| 8735 | /** |
| 8736 | * Validates that a string's Unicode code point count is within the specified inclusive range. |
| 8737 | * |
nothing calls this directly
no test coverage detected