* Creates a schema that trims whitespace from strings.
()
| 35 | * Creates a schema that trims whitespace from strings. |
| 36 | */ |
| 37 | function makeTrimType(): StandardSchemaV1<string, string> { |
| 38 | return { |
| 39 | "~standard": { |
| 40 | version: 1, |
| 41 | vendor: "test", |
| 42 | validate: (value) => { |
| 43 | if (typeof value !== "string") { |
| 44 | return { |
| 45 | issues: [{ message: "Expected string" }], |
| 46 | }; |
| 47 | } |
| 48 | return { value: value.trim() }; |
| 49 | }, |
| 50 | }, |
| 51 | }; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Creates a schema that parses string numbers to integers. |
no outgoing calls
no test coverage detected