MCPcopy Create free account
hub / github.com/PageLeay/celestial-runtime / isHexString

Function isHexString

lib.esm/utils/data.js:53–64  ·  view source on GitHub ↗
(value, length)

Source from the content-addressed store, hash-verified

51 * bytes of data (e.g. ``0x1234`` is 2 bytes).
52 */
53export 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).

Callers 15

fromMethod · 0.90
getSubscriptionFunction · 0.90
addAddressFunction · 0.90
_getBlockTagMethod · 0.90
#getBlockMethod · 0.90
spelunkDataFunction · 0.90
getPollingSubscriberFunction · 0.90
getAddressMethod · 0.90
getRpcErrorMethod · 0.90
formatDataFunction · 0.90
formatHashFunction · 0.90
formatUint256Function · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected