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

Function replace

ark/aot/flat.ts:1222–1231  ·  view source on GitHub ↗
(id: Node, text: string)

Source from the content-addressed store, hash-verified

1220 const wholeOf = (unit: string) => `[${membersOf.get(unit)!.join(", ")}]`
1221 const s = new MagicString(code)
1222 const replace = (id: Node, text: string) => {
1223 const parent = id.parent
1224 const isShorthand =
1225 parent?.type === "Property" && parent.shorthand && parent.value === id
1226 s.overwrite(
1227 id.start,
1228 id.end,
1229 isShorthand ? `${(id as { name: string }).name}: ${text}` : text
1230 )
1231 }
1232 const flattenFactory = (d: Factory) => {
1233 const body = d.fn.body as Block
1234 const renamed = new Map<Binding, string>()

Callers 5

flattenFactoryFunction · 0.70
writeFlatFunction · 0.70
replaceDataCallsFunction · 0.70
inlineMessageMethod · 0.50
replaceTrackedFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected