« get me outta code hell

validators: junk whitespace refactor and additions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-09 13:27:10 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-09 13:27:32 -0400
commitfb94c24043b9f7db8f5e9a9c0c64faaf95cc88ed (patch)
treedc6c8cbd28857ef46eb70ec225fb862d1f17ef8a /src/data/things
parentebeac7ba40450962bfba46c9c7b9d7eefb829225 (diff)
validators: junk whitespace refactor and additions
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/validators.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index f9910364..d02e5f28 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -408,19 +408,21 @@ export const validateAllPropertyValues = (validator) =>
     [validateProperties.validateOtherKeys]: validator,
   });
 
+const illeaglInvisibleSpace = {
+  action: 'delete',
+};
+
+const illegalVisibleSpace = {
+  action: 'replace',
+  with: ' ',
+  withAnnotation: `normal space`,
+};
+
 const illegalContentSpec = [
-  {
-    illegal: '\u200b',
-    action: 'delete',
-    annotation: `zero-width space`,
-  },
-  {
-    illegal: '\xa0',
-    action: 'replace',
-    with: ' ',
-    annotation: `non-breaking space`,
-    withAnnotation: `normal space`,
-  },
+  {illegal: '\u200b', annotation: `zero-width space`, ...illeaglInvisibleSpace},
+  {illegal: '\u2005', annotation: `four-per-em space`, ...illegalVisibleSpace},
+  {illegal: '\u205f', annotation: `medium mathematical space`, ...illegalVisibleSpace},
+  {illegal: '\xa0', annotation: `non-breaking space`, ...illegalVisibleSpace},
 ];
 
 for (const entry of illegalContentSpec) {