( regex: RegExp, description: string, jsonSchemaFormat?: JsonSchema.Format )
| 23 | // non-trivial expressions should have an explanation or attribution |
| 24 | |
| 25 | export 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 | |
| 44 | const stringIntegerRoot = regexStringNode( |
| 45 | wellFormedIntegerMatcher, |
no outgoing calls
no test coverage detected
searching dependent graphs…