Skip to content

Commit 1bbb8d7

Browse files
committed
chore: more explicit encodeAscii path check
1 parent 3386939 commit 1bbb8d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fallback/latin1.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ export function encodeAsciiPrefix(x, s) {
147147
export const encodeLatin1 = (str) => encodeCharcodes(str, new Uint8Array(str.length))
148148

149149
// Expects nativeEncoder to be present
150-
export const encodeAscii = isHermes
150+
const useEncodeInto = isHermes && nativeEncoder.encodeInto
151+
export const encodeAscii = useEncodeInto
151152
? (str, ERR) => {
152153
// Much faster in Hermes
153154
const codes = new Uint8Array(str.length + 4) // overshoot by a full utf8 char

0 commit comments

Comments
 (0)