Skip to content

Commit 8993271

Browse files
committed
chore: present iso-2022-jp-katakana as a regular table
1 parent 4caa41b commit 8993271

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

fallback/multi-byte.table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function getTable(id) {
106106
while (idx.length > 0) res.push([(a += idx.shift()), (b += idx.shift())]) // destroying, we remove it later anyway
107107
} else if (id.endsWith('-katakana')) {
108108
let a = -1
109-
res = indices[id].map((x) => (a += x + 1))
109+
res = new Uint16Array(indices[id].map((x) => (a += x + 1)))
110110
} else if (id === 'big5') {
111111
if (!Object.hasOwn(sizes, id)) throw new Error('Unknown encoding')
112112
res = new Uint32Array(sizes[id]) // array of strings or undefined

tests/multi-byte.tables.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ describe('multi-byte ranges tables', () => {
110110
})
111111

112112
describe('multi-byte encodings index: WHATWG non-normative indexes.json', () => {
113-
for (const [encoding, data] of Object.entries(multiByte)) {
113+
for (const [encoding, data] of Object.entries({
114+
...multiByte,
115+
'iso-2022-jp-katakana': katakana,
116+
})) {
114117
test(encoding, (t) => {
115118
t.assert.ok(!data.includes(0))
116119
t.assert.ok(!data.includes(0xff_fd))
@@ -131,8 +134,4 @@ describe('multi-byte encodings index: WHATWG non-normative indexes.json', () =>
131134
test('gb18030-ranges', (t) => {
132135
t.assert.deepStrictEqual(getTable('gb18030-ranges'), gb18030ranges)
133136
})
134-
135-
test('iso-2022-jp-katakana', (t) => {
136-
t.assert.deepStrictEqual(getTable('iso-2022-jp-katakana'), katakana)
137-
})
138137
})

0 commit comments

Comments
 (0)