All files / src/compiler/utils extract_svelte_ignore.js

100% Statements 18/18
100% Branches 4/4
100% Functions 1/1
100% Lines 17/17

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 15 16 17 182x 2x 2x 2x 2x 2x 2x 2x 2x 589x 589x 589x 98x 98x 98x 589x 589x  
import { regex_whitespace } from '../phases/patterns.js';
 
const regex_svelte_ignore = /^\s*svelte-ignore\s+([\s\S]+)\s*$/m;
 
/**
 * @param {string} text
 * @returns {string[]}
 */
export function extract_svelte_ignore(text) {
	const match = regex_svelte_ignore.exec(text);
	return match
		? match[1]
				.split(regex_whitespace)
				.map(/** @param {any} x */ (x) => x.trim())
				.filter(Boolean)
		: [];
}