]> git.codecow.com Git - nano25519.git/commitdiff
Remove unused export, remove static method capture, and fix doc comments.
authorChris Duncan <chris@codecow.com>
Thu, 15 Oct 2026 20:29:02 +0000 (13:29 -0700)
committerChris Duncan <chris@codecow.com>
Thu, 15 Oct 2026 20:29:02 +0000 (13:29 -0700)
src/lib/bytes.ts

index a62a80109fa8c3887a8045a7fd130a3036e09e3a..0bfaeff5fdab0e79858b2f9f460b3c4e074eea3e 100644 (file)
@@ -45,7 +45,6 @@ import { Nano25519RangeError, Nano25519TypeError, } from './errors'
 export type Bytes = Uint8Array<ArrayBuffer>
 export type Words = Uint32Array<ArrayBuffer>
 
-/** 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
 }