All files / src/web/shared fileReferences.ts

100% Statements 7/7
50% Branches 1/2
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14    15x 15x   15x 14x 14x 14x     15x    
/** Extract file references from script text matching the @filepath@ pattern. */
export function parseFileReferences(script: string): string[] {
	const matches = new Set<string>();
	const regex = /@([^@\r\n]+)@/g;
	let match: RegExpExecArray | null;
	while ((match = regex.exec(script)) !== null) {
		const reference = match[1].trim();
		Eif (reference) {
			matches.add(reference);
		}
	}
	return Array.from(matches);
}