]> zoso.dev Git - libnemo.git/commitdiff
Clarify array typings.
authorChris Duncan <chris@zoso.dev>
Tue, 26 Nov 2024 21:41:13 +0000 (13:41 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 26 Nov 2024 21:41:13 +0000 (13:41 -0800)
src/lib/convert.ts

index 630b8946eae86ec7b18012b829786ccabfa7383f..41bb662f3d29389ca0b33fe16d0d6f379fca6b6a 100644 (file)
@@ -45,7 +45,7 @@ export const bin = {
        * @returns {Uint8Array} Byte array representation of the input string\r
        */\r
        toBytes (bin: string): Uint8Array {\r
-               const bytes = []\r
+               const bytes: number[] = []\r
                while (bin.length > 0) {\r
                        const bits = bin.substring(0, 8)\r
                        bytes.push(parseInt(bits, 2))\r
@@ -222,7 +222,7 @@ export const dec = {
                        throw new TypeError('Invalid padding')\r
                }\r
                let integer = BigInt(decimal)\r
-               const bytes = []\r
+               const bytes: number[] = []\r
                while (integer > 0) {\r
                        const lsb = BigInt.asUintN(8, integer)\r
                        bytes.push(Number(lsb))\r