summaryrefslogtreecommitdiff
path: root/modules/unicode/unicode.js
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2022-04-13 11:51:20 +0200
committerTom Smeding <tom@tomsmeding.com>2022-04-13 11:58:20 +0200
commit1e790de760e1921fc079f9609e370296fc1d94c4 (patch)
treeb22a6c43b31a07352da2eb7ad1a0e251b9b46bf3 /modules/unicode/unicode.js
parentbaabe0c348009ee32069d79ad1a0febeab17631e (diff)
unicode: Properly report unknown codepoints
Diffstat (limited to 'modules/unicode/unicode.js')
-rw-r--r--modules/unicode/unicode.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/unicode/unicode.js b/modules/unicode/unicode.js
index 113ea83..ee83179 100644
--- a/modules/unicode/unicode.js
+++ b/modules/unicode/unicode.js
@@ -114,14 +114,18 @@ module.exports = function (app, io, moddir) {
app.get("/unicode/lookup/:query", (req, res) => {
const codepoints = [];
+ let notfound = "";
for (let codepoint of req.params.query) {
codepoint = codepoint.codePointAt(0);
- codepoints.push(lookupCode(codepoint));
+ const result = lookupCode(codepoint);
+ if (result != null) codepoints.push(result);
+ else notfound += String.fromCodePoint(codepoint);
}
res.json({
index: recogniseIndex(req.params.query) || undefined,
codepoints: codepoints,
+ notfound: notfound,
search: searchDescription(req.params.query),
});
});