« get me outta code hell

data: AdditionalName - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/yaml.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-05-16 15:40:15 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-05-16 15:40:15 -0300
commit613522d60b16aedf6893ee3a7d4aeeb539b31230 (patch)
tree0364f9d92d8aa049b253616eeb9d3e27e72dc6cd /src/data/yaml.js
parent30fbe117d5a08b8e5f1963e91fbd930935cc5a58 (diff)
data: AdditionalName
Diffstat (limited to 'src/data/yaml.js')
-rw-r--r--src/data/yaml.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index f3ba3f3b..45694237 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -619,23 +619,23 @@ export function parseAdditionalFiles(entries, {subdoc, AdditionalFile}) {
   });
 }
 
-export function parseAdditionalNames(entries) {
+export function parseAdditionalNames(entries, {subdoc, AdditionalName}) {
   return parseArrayEntries(entries, item => {
-    if (typeof item === 'object' && typeof item['Name'] === 'string')
-      return {
-        name: item['Name'],
-        annotation: item['Annotation'] ?? null,
-      };
+    if (typeof item === 'object') {
+      return subdoc(AdditionalName, item, {bindInto: 'thing'});
+    }
 
     if (typeof item !== 'string') return item;
 
     const match = item.match(extractAccentRegex);
     if (!match) return item;
 
-    return {
-      name: match.groups.main,
-      annotation: match.groups.accent ?? null,
+    const document = {
+      ['Name']: match.groups.main,
+      ['Annotation']: match.groups.accent ?? null,
     };
+
+    return subdoc(AdditionalName, document, {bindInto: 'thing'});
   });
 }