From: Chris Duncan Date: Thu, 15 Oct 2026 20:29:02 +0000 (-0700) Subject: Remove unused export, remove static method capture, and fix doc comments. X-Git-Tag: v2.0.0~1^2~17 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=b02a31c8733c6baef492f278effc453ae4569af9;p=nano25519.git Remove unused export, remove static method capture, and fix doc comments. --- diff --git a/src/lib/bytes.ts b/src/lib/bytes.ts index a62a801..0bfaeff 100644 --- a/src/lib/bytes.ts +++ b/src/lib/bytes.ts @@ -45,7 +45,6 @@ import { Nano25519RangeError, Nano25519TypeError, } from './errors' export type Bytes = Uint8Array export type Words = Uint32Array -/** Constructor bound before anything can replace the global. */ const TypedArray = Object.getPrototypeOf(Uint8Array.prototype) const bytesSet = Function.prototype.call.bind(Uint8Array.prototype.set) @@ -85,11 +84,6 @@ export function byteLength (bytes: Uint8Array): number { return getByteLength(bytes) } -/** Captured version of `Uint8Array.prototype.byteLength`. */ -export function byteOffset (bytes: Uint8Array): number { - return getByteOffset(bytes) -} - /** `target.set(source, offset)` through the captured method. */ export function copy (dst: Uint8Array, src: Uint8Array, offset?: number): void { return bytesSet(dst, src, offset) @@ -113,7 +107,6 @@ export function isBytes (a: unknown): a is Bytes { export const isLE = new Uint8Array(getBuffer(new Uint32Array([1])))[0] === 1 /** - * Captured version of `Uint32Array` reusing input offset and length. * Enables reading multiple bytes in a single load which is more efficient than * reading and combining individual bytes with bitshifts. The caller is * responsible for managing endianness. @@ -133,7 +126,6 @@ export function words (bytes: Bytes): Words { } const charCodeAt = Function.prototype.call.bind(String.prototype.charCodeAt) -const fromCharCode = String.fromCharCode /** 0-9a-f for a valid hex digit 0..15 */ function hexcode (c: number): number { @@ -160,7 +152,7 @@ export function bytesToHex (bytes: Uint8Array): string { let hex = '' for (let i = 0; i < byteLength; i++) { const byte = bytes[i] - hex += fromCharCode(hexcode(byte >> 4), hexcode(byte & 15)) + hex += String.fromCharCode(hexcode(byte >> 4), hexcode(byte & 15)) } return hex }