(value, length)
| 51 | * bytes of data (e.g. ``0x1234`` is 2 bytes). |
| 52 | */ |
| 53 | export function isHexString(value, length) { |
| 54 | if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { |
| 55 | return false; |
| 56 | } |
| 57 | if (typeof (length) === "number" && value.length !== 2 + 2 * length) { |
| 58 | return false; |
| 59 | } |
| 60 | if (length === true && (value.length % 2) !== 0) { |
| 61 | return false; |
| 62 | } |
| 63 | return true; |
| 64 | } |
| 65 | /** |
| 66 | * Returns true if %%value%% is a valid representation of arbitrary |
| 67 | * data (i.e. a valid [[DataHexString]] or a Uint8Array). |
no test coverage detected
searching dependent graphs…