« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/things/language.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index f8fe0106..0baea81d 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -283,10 +283,16 @@ export class Language extends Thing {
       throw new Error(`escapeHTML unavailable`);
     }
 
-    if (typeof arg === 'string') {
-      return escapeHTML(arg);
-    } else {
-      return arg;
+    switch (typeof arg) {
+      case 'string':
+        return escapeHTML(arg);
+
+      case 'number':
+      case 'boolean':
+        return arg.toString();
+
+      default:
+        return arg;
     }
   }