MCPcopy Create free account
hub / github.com/codemix/graph / makeTrimType

Function makeTrimType

packages/graph/src/test/standardSchema.test.ts:37–52  ·  view source on GitHub ↗

* Creates a schema that trims whitespace from strings.

()

Source from the content-addressed store, hash-verified

35 * Creates a schema that trims whitespace from strings.
36 */
37function 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.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected