]> git.codecow.com Git - libnemo.git/commitdiff
Make hex check case-insensitive.
authorChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 21:10:19 +0000 (14:10 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 3 Aug 2026 21:10:19 +0000 (14:10 -0700)
src/index.ts
src/lib/convert/hex.ts

index c1d18a58bae06d4f4f20b31e5836f899d4e71867..a10abd6f6e7f919058df1744f88597291f55d045 100644 (file)
@@ -14,7 +14,7 @@ declare global {
        type Bytes = Uint8Array<ArrayBuffer> | Buffer<ArrayBuffer>
        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 {
index df6e08c2fac50c6b6c5664822e64ff506a8d4f26..e4237c9e78bd937435388e73dfbdb09187615dc7 100644 (file)
@@ -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)
        },
 
        /**