« get me outta code hell

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:
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/art-tag.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index 3d65b578..7e466555 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -1,4 +1,6 @@
+import {exposeUpdateValueOrContinue} from '#composite';
 import {sortAlbumsTracksChronologically} from '#wiki-data';
+import {isName} from '#validators';
 
 import Thing, {
   color,
@@ -19,15 +21,20 @@ export class ArtTag extends Thing {
     color: color(),
     isContentWarning: flag(false),
 
-    nameShort: {
-      flags: {update: true, expose: true},
+    nameShort: [
+      exposeUpdateValueOrContinue(),
 
-      expose: {
+      {
         dependencies: ['name'],
-        transform: (value, {name}) =>
-          value ?? name.replace(/ \(.*?\)$/, ''),
+        compute: ({name}) =>
+          name.replace(/ \([^)]*?\)$/, ''),
       },
-    },
+
+      {
+        flags: {update: true, expose: true},
+        validate: {isName},
+      },
+    ],
 
     // Update only