jevstrudel.git / website / src / jev / songCode.mjs
1// A song's code as the page plays it: song.js with a `// @title` line
2// first when it has none (the REPL titles the tab from it,
3// metadata_parser.js), so the title lives only in SPEC.md. One source for
4// the song index (songs.mjs) and for anything that must match the code a
5// listener heard, such as a performance's code hash (tools/jev-history/).
6export const songCode = (raw, title) => (raw && !/@title\b/.test(raw) ? `// @title ${title}\n${raw}` : raw);