| 4259 | * @since 3.10.0 |
| 4260 | */ |
| 4261 | export const trimmed = <S extends Schema.Any>( |
| 4262 | annotations?: Annotations.Filter<Schema.Type<S>> |
| 4263 | ) => |
| 4264 | <A extends string>(self: S & Schema<A, Schema.Encoded<S>, Schema.Context<S>>): filter<S> => |
| 4265 | self.pipe( |
| 4266 | filter((a) => a === a.trim(), { |
| 4267 | schemaId: TrimmedSchemaId, |
| 4268 | title: "trimmed", |
| 4269 | description: "a string with no leading or trailing whitespace", |
| 4270 | jsonSchema: { pattern: "^\\S[\\s\\S]*\\S$|^\\S$|^$" }, |
| 4271 | ...annotations |
| 4272 | }) |
| 4273 | ) |
| 4274 | |
| 4275 | /** |
| 4276 | * @category schema id |