From 94d5f4f5680b058c9428fa4e931a133953ef913f Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 3 Jul 2026 01:21:02 -0700 Subject: [PATCH] Skip reassignment. --- src/lib/convert/bytes.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/lib/convert/bytes.ts b/src/lib/convert/bytes.ts index 033a818..7b693bc 100644 --- a/src/lib/convert/bytes.ts +++ b/src/lib/convert/bytes.ts @@ -28,8 +28,7 @@ export const bytes = Object.freeze({ if (bytes == null) return if (bytes instanceof ArrayBuffer && bytes.byteLength === 0) return if (bytes instanceof Uint8Array && bytes.buffer.byteLength === 0) return - bytes = bytes instanceof ArrayBuffer ? new Uint8Array(bytes) : bytes - bytes.fill(0) + bytes instanceof ArrayBuffer ? new Uint8Array(bytes).fill(0) : bytes.fill(0) }, /** @@ -50,10 +49,8 @@ export const bytes = Object.freeze({ */ toBase32 (bytes: ArrayBuffer | Bytes): string { if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes) - const leftover = (bytes.length * 8) % 5 - const offset = leftover === 0 - ? 0 - : 5 - leftover + const leftover = (bytes.length << 3) % 5 + const offset = (5 - leftover) % 5 let value = 0 let output = '' let bits = 0 -- 2.52.0