« 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.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index 4481af55..27bee3e4 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -255,7 +255,7 @@ export class Language extends Thing {
   // treated by the browser as a tag. This does *not* have an effect on actual
   // html.Tag objects, which are treated as sanitized by default (so that they
   // can be nested inside strings at all).
-  #sanitizeStringArg(arg) {
+  #sanitizeStringArg(arg, {preserveType = false} = {}) {
     const escapeHTML = CacheableObject.getUpdateValue(this, 'escapeHTML');
 
     if (!escapeHTML) {
@@ -263,7 +263,12 @@ export class Language extends Thing {
     }
 
     if (typeof arg !== 'string') {
-      return arg.toString();
+      // TODO: Preserving type will be the only behavior.
+      if (preserveType) {
+        return arg;
+      } else {
+        return arg.toString();
+      }
     }
 
     return escapeHTML(arg);