| 4290 | */ |
| 4291 | export 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 |