diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-29 16:51:57 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-12-30 13:23:08 -0400 |
commit | 7c47a5a4cae560a8105d2044f18fbf448901252b (patch) | |
tree | fc14829beffa61c2690cd64a71dc44014034d241 /src | |
parent | b4e8afb733cf191b3b5333f7aafddf0802d04b39 (diff) |
data: language: stringify numbers and booleans in particular
Diffstat (limited to 'src')
-rw-r--r-- | src/data/things/language.js | 14 |
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; } } |