Skip to content

Commit 815f135

Browse files
committed
perf: prefer typed array
1 parent 7bddb51 commit 815f135

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fallback/windows1252.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { isHermes } from './_utils.js'
33

44
// 0x80-0x9f is the Windows1252 byte range that maps differently from Latin1 / Unicode subset
55
// prettier-ignore
6-
const map = [
6+
const map = Uint16Array.of(
77
0x20_ac, 0x00_81, 0x20_1a, 0x01_92, 0x20_1e, 0x20_26, 0x20_20, 0x20_21, // 0x80 - 0x87
88
0x02_c6, 0x20_30, 0x01_60, 0x20_39, 0x01_52, 0x00_8d, 0x01_7d, 0x00_8f, // 0x88 - 0x8F
99
0x00_90, 0x20_18, 0x20_19, 0x20_1c, 0x20_1d, 0x20_22, 0x20_13, 0x20_14, // 0x90 - 0x97
1010
0x02_dc, 0x21_22, 0x01_61, 0x20_3a, 0x01_53, 0x00_9d, 0x01_7e, 0x01_78, // 0x98 - 0x9F
11-
]
11+
)
1212

1313
function mappedCopy(arr, start = 0) {
1414
const out = Uint16Array.from(start === 0 ? arr : arr.subarray(start)) // copy to modify in-place, also those are 16-bit now

0 commit comments

Comments
 (0)