( source: string, marker: string, from = 0, )
| 34 | } |
| 35 | |
| 36 | function 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 | |
| 53 | function findMarkerBlock(source: string, kind: 'EDITMODE' | 'TWEAK-SCHEMA'): MarkerBlock | null { |
| 54 | const begin = findMarker(source, `${kind}-BEGIN`); |
no test coverage detected