Skip to content

Commit ba0c8fd

Browse files
authored
rework browser handling for buffer decoding (#104)
1 parent 0f605c4 commit ba0c8fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/lexer.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ function copyLE (src, outBuf16) {
9292

9393
function getWasmBytes() {
9494
const binary = 'WASM_BINARY'; // This string will be replaced by build.js.
95-
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof atob === 'function')
96-
return Uint8Array.from(atob(binary), x => x.charCodeAt(0));
97-
return Buffer.from(binary, 'base64');
95+
if (typeof Buffer !== 'undefined')
96+
return Buffer.from(binary, 'base64');
97+
return Uint8Array.from(atob(binary), x => x.charCodeAt(0));
9898
}
9999

100100
let initPromise;

0 commit comments

Comments
 (0)