From: Chris Duncan Date: Mon, 3 Aug 2026 21:10:19 +0000 (-0700) Subject: Make hex check case-insensitive. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=be9eebe3ab415581a735f39eb064aa96f7aa9473;p=libnemo.git Make hex check case-insensitive. --- diff --git a/src/index.ts b/src/index.ts index c1d18a5..a10abd6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,7 +14,7 @@ declare global { type Bytes = Uint8Array | Buffer type Hex = HexByte[] type HexByte = `${HexChar}${HexChar}` - type HexChar = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' + type HexChar = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' } export { diff --git a/src/lib/convert/hex.ts b/src/lib/convert/hex.ts index df6e08c..e4237c9 100644 --- a/src/lib/convert/hex.ts +++ b/src/lib/convert/hex.ts @@ -9,7 +9,7 @@ export const hex = Object.freeze({ * @returns True if input is hex, else false */ is (input: unknown): input is Hex { - return typeof input === 'string' && /^([0-9a-f]{2})+$/.test(input) + return typeof input === 'string' && /^([0-9A-F]{2})+$/i.test(input) }, /**