16 lines
497 B
JavaScript
16 lines
497 B
JavaScript
export function isHexString(value, length) {
|
|
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
|
|
return false;
|
|
}
|
|
if (typeof (length) === "number" && value.length !== 2 + 2 * length) {
|
|
return false;
|
|
}
|
|
if (length === true && (value.length % 2) !== 0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
export function isBytesLike(value) {
|
|
return (isHexString(value, true) || (value instanceof Uint8Array));
|
|
}
|
|
//# sourceMappingURL=check.js.map
|