Skip to content

Commit 565c4bb

Browse files
committed
feat(core): improve isHex parameter
1 parent b52feda commit 565c4bb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/core/src/hex/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ export type HexLike = BytesLike;
2121
* - Has an even length.
2222
* - Contains only characters representing digits (0-9) or lowercase letters (a-f) after the "0x" prefix.
2323
*
24-
* @param s - The string to validate as a hexadecimal (ccc.Hex) string.
24+
* @param v - The value to validate as a hexadecimal (ccc.Hex) string.
2525
* @returns True if the string is a valid hex string, false otherwise.
2626
*/
27-
export function isHex(s: unknown): s is Hex {
28-
if (!(typeof s === "string" && s.length % 2 === 0 && s.startsWith("0x"))) {
27+
export function isHex(v: unknown): v is Hex {
28+
if (!(typeof v === "string" && v.length % 2 === 0 && v.startsWith("0x"))) {
2929
return false;
3030
}
3131

32-
for (let i = 2; i < s.length; i++) {
33-
const c = s.charAt(i);
32+
for (let i = 2; i < v.length; i++) {
33+
const c = v.charAt(i);
3434
if (!(("0" <= c && c <= "9") || ("a" <= c && c <= "f"))) {
3535
return false;
3636
}

0 commit comments

Comments
 (0)