All files / src/lib/content strip-seed-prefix.ts

100% Statements 5/5
100% Branches 4/4
100% Functions 2/2
100% Lines 4/4

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 18              1x     8x 5x       5x    
// Strips `[Seed]`/`[E2E]` prefixes that the seed factories prepend to fixture
// pros so dev rendering and JSON-LD don't leak fixture-only marketing copy.
// Production pros are never prefixed, so this is a no-op on prod.
//
// Applied at the marketplace layer (close to display) rather than the API/DB
// because the prefix is intentional supply-side metadata — useful for admin
// debugging — but actively harmful as SEO surface.
const SEED_PREFIX_RE = /^\s*\[(?:Seed|E2E)\]\s+/i;
 
export function stripSeedPrefix(name: string | null | undefined): string {
	if (!name) return "";
	return name.replace(SEED_PREFIX_RE, "");
}
 
export function isSeedName(name: string | null | undefined): boolean {
	return !!name && SEED_PREFIX_RE.test(name);
}