MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / sfcBlockLineRanges

Function sfcBlockLineRanges

src/extraction/sfc-script.ts:84–94  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

82 * covers nothing.
83 */
84export function sfcBlockLineRanges(source: string): Array<[number, number]> {
85 const ranges: Array<[number, number]> = [];
86 const elements = new RegExp(SFC_SCRIPT_OR_STYLE_ELEMENT);
87 let match: RegExpExecArray | null;
88 while ((match = elements.exec(source)) !== null) {
89 if (!sfcElementHasBody(match[0])) continue;
90 const startLine = (source.substring(0, match.index).match(/\n/g) || []).length;
91 ranges.push([startLine, startLine + (match[0].match(/\n/g) || []).length]);
92 }
93 return ranges;
94}
95
96/**
97 * Whether a `<script>` element's attributes leave it JavaScript or

Callers 1

Calls 3

sfcElementHasBodyFunction · 0.85
pushMethod · 0.80
execMethod · 0.65

Tested by

no test coverage detected