MCPcopy Create free account
hub / github.com/PatrickJS/awesome-cursorrules / parseFrontmatter

Function parseFrontmatter

scripts/check-repo-hygiene.mjs:848–857  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

846}
847
848function parseFrontmatter(content) {
849 if (!content.startsWith("---\n") && !content.startsWith("---\r\n")) {
850 return null;
851 }
852
853 const normalized = content.replace(/\r\n/g, "\n");
854 const end = normalized.indexOf("\n---", 4);
855 if (end === -1) return null;
856 return normalized.slice(4, end);
857}
858
859function readFrontmatterField(frontmatter, field) {
860 const pattern = new RegExp(`^${field}\\s*:(.*)$`);

Callers 1

checkRuleFrontmatterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected