MCPcopy Create free account
hub / github.com/arktypeio/arktype / idPrefixOf

Function idPrefixOf

ark/schema/parse.ts:132–137  ·  view source on GitHub ↗
(written: string)

Source from the content-addressed store, hash-verified

130const idPrefixes: PartialRecord<string, string> = Object.create(null)
131
132const idPrefixOf = (written: string): string => {
133 let prefix = written.replace(/[^\w$]/g, "_")
134 if (!prefix || /^\d/.test(prefix)) prefix = `_${prefix}`
135 if (/\d$/.test(prefix)) prefix += "_"
136 return prefix
137}
138
139export const parseNode = (ctx: NodeParseContext): BaseNode => {
140 const impl = nodeImplementationsByKind[ctx.kind]

Callers 1

registerNodeIdFunction · 0.85

Calls 2

replaceMethod · 0.80
testMethod · 0.80

Tested by

no test coverage detected