(value: any, length?: number | boolean)
| 75 | * bytes of data (e.g. ``0x1234`` is 2 bytes). |
| 76 | */ |
| 77 | export function isHexString(value: any, length?: number | boolean): value is `0x${ string }` { |
| 78 | if (typeof(value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { |
| 79 | return false |
| 80 | } |
| 81 | |
| 82 | if (typeof(length) === "number" && value.length !== 2 + 2 * length) { return false; } |
| 83 | if (length === true && (value.length % 2) !== 0) { return false; } |
| 84 | |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Returns true if %%value%% is a valid representation of arbitrary |
no outgoing calls
no test coverage detected