Skip to content

Commit 78f016d

Browse files
committed
refactor: move iso-8859-8-i to fallback
1 parent 12b7249 commit 78f016d

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

fallback/single-byte.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@ import { decode2string } from './_utils.js'
44

55
export const E_STRICT = 'Input is not well-formed for this encoding'
66
const xUserDefined = 'x-user-defined'
7+
const iso8i = 'iso-8859-8-i'
78

89
export const assertEncoding = (encoding) => {
9-
if (Object.hasOwn(encodings, encoding) || encoding === xUserDefined) return
10+
if (Object.hasOwn(encodings, encoding) || encoding === xUserDefined || encoding === iso8i) return
1011
throw new RangeError('Unsupported encoding')
1112
}
1213

1314
const f = 0xff_fd
1415

1516
function getEncoding(encoding) {
1617
assertEncoding(encoding)
17-
if (encoding === xUserDefined) {
18-
return Array.from({ length: 128 }, (_, i) => 0xf7_80 + i)
19-
}
20-
18+
if (encoding === xUserDefined) return Array.from({ length: 128 }, (_, i) => 0xf7_80 + i)
19+
if (encoding === iso8i) encoding = 'iso-8859-8'
2120
let prev = 127
2221
return encodings[encoding].map((x) => (x === f ? x : (prev += x))) // eslint-disable-line no-return-assign
2322
}

single-byte.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ function shouldUseNative(enc) {
2929
}
3030

3131
export function createSinglebyteDecoder(encoding, loose = false) {
32-
if (encoding === 'iso-8859-8-i') encoding = 'iso-8859-8'
3332
assertEncoding(encoding)
3433

3534
if (canDecoders && shouldUseNative(encoding)) {

single-byte.node.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ function latin1Prefix(arr, start) {
2424
}
2525

2626
export function createSinglebyteDecoder(encoding, loose = false) {
27-
if (encoding === 'iso-8859-8-i') encoding = 'iso-8859-8'
2827
const latin1path = encoding === 'windows-1252'
2928
if (isDeno) {
3029
const jsDecoder = encodingDecoder(encoding) // asserts

0 commit comments

Comments
 (0)