From 25b1b3c1ddd5f6ab0f355d86f3de39c9af11d89b Mon Sep 17 00:00:00 2001 From: Mark Wylde Date: Mon, 4 Dec 2023 21:04:57 +0000 Subject: [PATCH] fix: lint --- src/utils/decode_base64.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/utils/decode_base64.ts b/src/utils/decode_base64.ts index 16732d4..ca702fe 100644 --- a/src/utils/decode_base64.ts +++ b/src/utils/decode_base64.ts @@ -1,23 +1,24 @@ export function decodeBase64(b64: string): Uint8Array { - const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - let base64 = b64.replace(/-/g, '+').replace(/_/g, '/'); + const chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + let base64 = b64.replace(/-/g, "+").replace(/_/g, "/"); while (base64.length % 4) { - base64 += '='; + base64 += "="; } - let bitString = ''; + let bitString = ""; for (let i = 0; i < base64.length; i++) { - const char = base64.charAt(i); - if (char !== '=') { - const charIndex = chars.indexOf(char); - bitString += charIndex.toString(2).padStart(6, '0'); - } + const char = base64.charAt(i); + if (char !== "=") { + const charIndex = chars.indexOf(char); + bitString += charIndex.toString(2).padStart(6, "0"); + } } const bytes = new Uint8Array(bitString.length / 8); for (let i = 0; i < bytes.length; i++) { - bytes[i] = parseInt(bitString.substring(8 * i, 8 * (i + 1)), 2); + bytes[i] = parseInt(bitString.substring(8 * i, 8 * (i + 1)), 2); } return bytes;