isHex

Checks if a value is a valid hexadecimal string.

Example

import { isHex } from "thirdweb/utils";
const result = isHex("0x1a4");
console.log(result); // true
function isHex(
value: unknown,
options: IsHexOptions,
): value is `0x${string}`;

Parameters

The value to be checked.

Type

let value: unknown;

Optional configuration for the validation.

Type

let options: { strict?: boolean };

Returns

let returnType: value is (`0x${string}`)

True if the value is a valid hexadecimal string, false otherwise.