MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / applyEdits

Function applyEdits

scripts/migrate-schema-class.ts:247–255  ·  view source on GitHub ↗
(text: string, edits: Edit[])

Source from the content-addressed store, hash-verified

245};
246
247const applyEdits = (text: string, edits: Edit[]): string => {
248 // Apply in reverse order so positions stay valid.
249 const sorted = [...edits].sort((a, b) => b.start - a.start);
250 let out = text;
251 for (const edit of sorted) {
252 out = out.slice(0, edit.start) + edit.replacement + out.slice(edit.end);
253 }
254 return out;
255};
256
257// ---------------------------------------------------------------------------
258// Pass 1 — discover every migrated class name (cross-file) so we can rewrite

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected