From: Chris Duncan Date: Mon, 21 Jul 2025 20:19:18 +0000 (-0700) Subject: Remove unused convert functions. X-Git-Tag: v0.10.5~55^2~39 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=f30cdff6de582e73313ad9906ba3dc84169031df;p=libnemo.git Remove unused convert functions. --- diff --git a/src/lib/convert.ts b/src/lib/convert.ts index 51a4cbb..32d7067 100644 --- a/src/lib/convert.ts +++ b/src/lib/convert.ts @@ -53,16 +53,6 @@ export class bin { } return new Uint8Array(bytes) } - - /** - * Convert a binary string to a hexadecimal string. - * - * @param {string} bin - String to convert - * @returns {string} Hexadecimal string representation of the input binary - */ - static toHex (bin: string): string { - return parseInt(bin, 2).toString(16) - } } export class bytes { @@ -85,26 +75,6 @@ export class bytes { bytes.buffer.transfer() } - /** - * Convert a Uint8Array to an array of decimal byte values. - * - * @param {Uint8Array} bytes - Byte array to convert - * @param {number}[padding=0] - Minimum length of the resulting array padded as necessary with starting 0 values - * @returns {number[]} Decimal array representation of the input value - */ - static toArray (bytes: Uint8Array, padding: number = 0): number[] { - if (!(bytes instanceof Uint8Array)) { - throw new TypeError('bytes must be Uint8Array') - } - const byteArray = [...bytes.values()] - padding -= bytes.byteLength - if (padding > 0) { - const zeros = new Array(padding) - byteArray.splice(0, 0, ...zeros) - } - return byteArray - } - /** * Convert a Uint8Aarray of bytes to a base32 string. *