From: Chris Duncan Date: Sat, 10 Oct 2026 05:22:16 +0000 (-0700) Subject: Fix static string method and remove unused constants. X-Git-Tag: v2.0.0~1^2~46 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=27ff856f10e650c04abf9270edbc2d749427e9b4;p=nano25519.git Fix static string method and remove unused constants. --- diff --git a/src/lib/primordials.ts b/src/lib/primordials.ts index 636ec12..8b4d0a4 100644 --- a/src/lib/primordials.ts +++ b/src/lib/primordials.ts @@ -50,8 +50,6 @@ const TypedArray = Object.getPrototypeOf(Bytes.prototype) const bytesSet = Function.prototype.call.bind(Bytes.prototype.set) const bytesFill = Function.prototype.call.bind(Bytes.prototype.fill) -const charCodeAt = Function.prototype.call.bind(String.prototype.charCodeAt) -const fromCharCode = Function.prototype.call.bind(String.fromCharCode) function get (target: object, key: PropertyKey): (this: unknown) => T { const found = Object.getOwnPropertyDescriptor(target, key) @@ -151,13 +149,8 @@ export function words (bytes: Bytes): Words { return new Words(getBuffer(bytes) as ArrayBuffer, offset, getByteLength(bytes) >> 2) } -const LOWER = '0123456789abcdef' -const UPPER = '0123456789ABCDEF' -const NIBBLE: Record = Object.create(null) -for (let i = 0; i < 16; i++) { - NIBBLE[LOWER[i]] = i - NIBBLE[UPPER[i]] = i -} +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 {