« get me outta code hell

validators, test: define various validators with isContentString - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-05 22:02:27 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-06 12:50:30 -0400
commit01a1e04649907aaf73564b3442f683cab73c3a78 (patch)
treebf6e23aab390d4682f0af25acf2a3eaa6850ffa4 /src/data
parentf46e4c2eba7cfc194907e767893e8c89c072c338 (diff)
validators, test: define various validators with isContentString
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/validators.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index bff2b703..1ef23d07 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -299,7 +299,7 @@ export function isColor(color) {
 }
 
 export function isCommentary(commentaryText) {
-  isString(commentaryText);
+  isContentString(commentaryText);
 
   const rawMatches =
     Array.from(commentaryText.matchAll(commentaryRegex));
@@ -546,15 +546,15 @@ export const isContribution = validateProperties({
 export const isContributionList = validateArrayItems(isContribution);
 
 export const isAdditionalFile = validateProperties({
-  title: isString,
-  description: optional(isStringNonEmpty),
+  title: isName,
+  description: optional(isContentString),
   files: validateArrayItems(isString),
 });
 
 export const isAdditionalFileList = validateArrayItems(isAdditionalFile);
 
 export const isTrackSection = validateProperties({
-  name: optional(isString),
+  name: optional(isName),
   color: optional(isColor),
   dateOriginallyReleased: optional(isDate),
   isDefaultTrackSection: optional(isBoolean),
@@ -614,7 +614,7 @@ export function isLanguageCode(string) {
 }
 
 export function isName(name) {
-  return isString(name);
+  return isContentString(name);
 }
 
 export function isURL(string) {
@@ -748,7 +748,7 @@ export function validateWikiData({
 
 export const isAdditionalName = validateProperties({
   name: isName,
-  annotation: optional(isStringNonEmpty),
+  annotation: optional(isContentString),
 
   // TODO: This only allows indicating sourcing from a track.
   // That's okay for the current limited use of "from", but