diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-02-26 18:01:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 18:01:52 -0400 |
commit | 2b2f252f246053bd52c36948748a3425d1c950a1 (patch) | |
tree | 38c01f7eb55d45e83ed0fe0055480c9af9e76708 /src/data/things/validators.js | |
parent | f36f93b702729f14021746d56b192b25ac3ed1b7 (diff) | |
parent | 3b873a6d04f3d317423d1a037536692de808b6fe (diff) |
Merge pull request #151 from hsmusic/data-format-cleanup
Data format cleanup
Diffstat (limited to 'src/data/things/validators.js')
-rw-r--r-- | src/data/things/validators.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js index 24db3c79..b116120a 100644 --- a/src/data/things/validators.js +++ b/src/data/things/validators.js @@ -195,7 +195,18 @@ export function isColor(color) { } export function isCommentary(commentary) { - return isString(commentary); + isString(commentary); + + const [firstLine] = commentary.match(/.*/); + if (!firstLine.replace(/<\/b>/g, '').includes(':</i>')) { + throw new TypeError(`Missing commentary citation: "${ + firstLine.length > 40 + ? firstLine.slice(0, 40) + '...' + : firstLine + }"`); + } + + return true; } const isArtistRef = validateReference('artist'); |