@finbheara/domain 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6943,9 +6943,11 @@ function createPlaceReader2(options = {}) {
|
|
|
6943
6943
|
ancestorsOf.set(n.id, out);
|
|
6944
6944
|
}
|
|
6945
6945
|
const phrases = [...byPrint.keys()].filter((k) => k.includes(" ")).sort((a, b) => b.length - a.length);
|
|
6946
|
+
const printsSorted = [...byPrint.keys()].map((k, i) => [k, i]).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
6946
6947
|
return {
|
|
6947
6948
|
byId,
|
|
6948
6949
|
byPrint,
|
|
6950
|
+
printsSorted,
|
|
6949
6951
|
byCode,
|
|
6950
6952
|
byTruncation,
|
|
6951
6953
|
byCountryCode,
|
|
@@ -7190,13 +7192,32 @@ function createPlaceReader2(options = {}) {
|
|
|
7190
7192
|
function completions(folded) {
|
|
7191
7193
|
if (folded.length < MIN_STEM)
|
|
7192
7194
|
return [];
|
|
7195
|
+
const i = idx();
|
|
7196
|
+
const sorted = i.printsSorted;
|
|
7197
|
+
let lo = 0;
|
|
7198
|
+
let hi = sorted.length;
|
|
7199
|
+
while (lo < hi) {
|
|
7200
|
+
const mid = lo + hi >>> 1;
|
|
7201
|
+
if (sorted[mid][0] < folded)
|
|
7202
|
+
lo = mid + 1;
|
|
7203
|
+
else
|
|
7204
|
+
hi = mid;
|
|
7205
|
+
}
|
|
7206
|
+
const run = [];
|
|
7207
|
+
for (let k = lo;k < sorted.length; k++) {
|
|
7208
|
+
const at = sorted[k];
|
|
7209
|
+
if (!at[0].startsWith(folded))
|
|
7210
|
+
break;
|
|
7211
|
+
run.push(at);
|
|
7212
|
+
}
|
|
7213
|
+
run.sort((a, b) => a[1] - b[1]);
|
|
7193
7214
|
const out = [];
|
|
7194
|
-
for (const [key
|
|
7195
|
-
if (key.length <= folded.length
|
|
7215
|
+
for (const [key] of run) {
|
|
7216
|
+
if (key.length <= folded.length)
|
|
7196
7217
|
continue;
|
|
7197
7218
|
if (key[folded.length] === " ")
|
|
7198
7219
|
continue;
|
|
7199
|
-
for (const n of
|
|
7220
|
+
for (const n of i.byPrint.get(key))
|
|
7200
7221
|
if (n.kind !== "body" && n.listedCutsOnly !== true)
|
|
7201
7222
|
out.push({ node: n, length: key.length });
|
|
7202
7223
|
}
|
package/dist/place.js
CHANGED
package/dist/promotion.js
CHANGED
|
@@ -46,7 +46,7 @@ function samePromotedRow(was, now) {
|
|
|
46
46
|
}
|
|
47
47
|
var STOOD_FOR = /^(?:'|(?![A-Za-z])\p{L})$/u;
|
|
48
48
|
function questionMarksRead(was, now) {
|
|
49
|
-
const a = [...collapse(mojibakeRead(was))];
|
|
49
|
+
const a = [...collapse(cp437Read(mojibakeRead(was), now))];
|
|
50
50
|
if (!a.includes("?"))
|
|
51
51
|
return a.join("");
|
|
52
52
|
const b = [...collapse(now)];
|
|
@@ -67,6 +67,47 @@ function questionMarksRead(was, now) {
|
|
|
67
67
|
}
|
|
68
68
|
return out.join("");
|
|
69
69
|
}
|
|
70
|
+
var CP437_LETTERS = new Map([
|
|
71
|
+
[128, "Ç"],
|
|
72
|
+
[129, "ü"],
|
|
73
|
+
[130, "é"],
|
|
74
|
+
[131, "â"],
|
|
75
|
+
[132, "ä"],
|
|
76
|
+
[133, "à"],
|
|
77
|
+
[134, "å"],
|
|
78
|
+
[135, "ç"],
|
|
79
|
+
[136, "ê"],
|
|
80
|
+
[137, "ë"],
|
|
81
|
+
[138, "è"],
|
|
82
|
+
[139, "ï"],
|
|
83
|
+
[140, "î"],
|
|
84
|
+
[141, "ì"],
|
|
85
|
+
[142, "Ä"],
|
|
86
|
+
[143, "Å"],
|
|
87
|
+
[144, "É"],
|
|
88
|
+
[145, "æ"],
|
|
89
|
+
[147, "ô"],
|
|
90
|
+
[148, "ö"],
|
|
91
|
+
[149, "ò"],
|
|
92
|
+
[150, "û"],
|
|
93
|
+
[151, "ù"],
|
|
94
|
+
[152, "ÿ"],
|
|
95
|
+
[153, "Ö"],
|
|
96
|
+
[154, "Ü"],
|
|
97
|
+
[160, "á"],
|
|
98
|
+
[161, "í"],
|
|
99
|
+
[162, "ó"],
|
|
100
|
+
[163, "ú"],
|
|
101
|
+
[164, "ñ"],
|
|
102
|
+
[165, "Ñ"]
|
|
103
|
+
].map(([byte, letter]) => [String.fromCodePoint(byte), letter]));
|
|
104
|
+
function cp437Read(was, now) {
|
|
105
|
+
const a = [...was];
|
|
106
|
+
const b = [...now];
|
|
107
|
+
if (a.length !== b.length)
|
|
108
|
+
return was;
|
|
109
|
+
return a.map((x, i) => CP437_LETTERS.get(x) === b[i] ? b[i] : x).join("");
|
|
110
|
+
}
|
|
70
111
|
function mojibakeRead(print) {
|
|
71
112
|
let out = print;
|
|
72
113
|
const codes = [...out].map((c) => c.codePointAt(0) ?? 0);
|
package/dist/school.js
CHANGED
package/package.json
CHANGED