From 7c47a5a4cae560a8105d2044f18fbf448901252b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 29 Dec 2023 16:51:57 -0400 Subject: data: language: stringify numbers and booleans in particular --- src/data/things/language.js | 14 ++++++++++---- 1 file 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; } } -- cgit 1.3.0-6-gf8a5