MCPcopy
hub / github.com/arktypeio/arktype / regexStringNode

Function regexStringNode

ark/type/keywords/string.ts:25–42  ·  view source on GitHub ↗
(
	regex: RegExp,
	description: string,
	jsonSchemaFormat?: JsonSchema.Format
)

Source from the content-addressed store, hash-verified

23// non-trivial expressions should have an explanation or attribution
24
25export const regexStringNode = (
26 regex: RegExp,
27 description: string,
28 jsonSchemaFormat?: JsonSchema.Format
29): Intersection.Node => {
30 const schema: mutableNormalizedRootOfKind<"intersection"> = {
31 domain: "string",
32 pattern: {
33 rule: regex.source,
34 flags: regex.flags,
35 meta: description
36 }
37 }
38
39 if (jsonSchemaFormat) schema.meta = { format: jsonSchemaFormat }
40
41 return node("intersection", schema) as never
42}
43
44const stringIntegerRoot = regexStringNode(
45 wellFormedIntegerMatcher,

Callers 1

string.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…