MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / findMarker

Function findMarker

packages/shared/src/editmode.ts:36–51  ·  view source on GitHub ↗
(
  source: string,
  marker: string,
  from = 0,
)

Source from the content-addressed store, hash-verified

34}
35
36function findMarker(
37 source: string,
38 marker: string,
39 from = 0,
40): { start: number; end: number } | null {
41 let start = source.indexOf('/*', from);
42 while (start >= 0) {
43 const end = source.indexOf('*/', start + 2);
44 if (end < 0) return null;
45 if (compactMarkerName(source.slice(start + 2, end)) === marker) {
46 return { start, end: end + 2 };
47 }
48 start = source.indexOf('/*', end + 2);
49 }
50 return null;
51}
52
53function findMarkerBlock(source: string, kind: 'EDITMODE' | 'TWEAK-SCHEMA'): MarkerBlock | null {
54 const begin = findMarker(source, `${kind}-BEGIN`);

Callers 1

findMarkerBlockFunction · 0.85

Calls 1

compactMarkerNameFunction · 0.85

Tested by

no test coverage detected