MCPcopy Index your code
hub / github.com/Effect-TS/effect / maxLength

Function maxLength

packages/effect/src/Schema.ts:4292–4305  ·  view source on GitHub ↗
(maxLength: number, annotations?: Annotations.Filter<Schema.Type<S>>)

Source from the content-addressed store, hash-verified

4290 */
4291export const maxLength =
4292 <S extends Schema.Any>(maxLength: number, annotations?: Annotations.Filter<Schema.Type<S>>) =>
4293 <A extends string>(self: S & Schema<A, Schema.Encoded<S>, Schema.Context<S>>): filter<S> =>
4294 self.pipe(
4295 filter(
4296 (a) => a.length <= maxLength,
4297 {
4298 schemaId: MaxLengthSchemaId,
4299 title: `maxLength(${maxLength})`,
4300 description: `a string at most ${maxLength} character(s) long`,
4301 jsonSchema: { maxLength },
4302 ...annotations
4303 }
4304 )
4305 )
4306
4307/**
4308 * @category schema id

Callers

nothing calls this directly

Calls 2

filterFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected