From a618d14d323f4eb230321a3609bfbc9f23f430c0 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Tue, 10 Aug 2021 17:44:25 +0800 Subject: [PATCH] fix: make lib loadable on ie9 (#30) --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6ab2710..2de9733 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; // Use a lookup table to find the index. -const lookup = new Uint8Array(256); +const lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); for (let i = 0; i < chars.length; i++) { lookup[chars.charCodeAt(i)] = i; }