« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/language.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/data/language.js b/src/data/language.js
index b8f58efd..3edf7e51 100644
--- a/src/data/language.js
+++ b/src/data/language.js
@@ -110,7 +110,13 @@ export function unflattenLanguageSpec(flat, reference) {
       }
 
       if (typeof result === 'string') {
-        delete ownNode[firstKey];
+        // When an algorithm faces a corner case, don't rethink the algorithm;
+        // hard-code the right thing to do.
+        if (typeof ownNode[firstKey] === 'object' && empty(restKeys) && ownNode[firstKey]._) {
+          delete ownNode[firstKey]._;
+        } else {
+          delete ownNode[firstKey];
+        }
         return {[firstKey]: result};
       }