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

Function dataSlice

lib.esm/utils/data.js:107–115  ·  view source on GitHub ↗
(data, start, end)

Source from the content-addressed store, hash-verified

105 * By default %%start%% is 0 and %%end%% is the length of %%data%%.
106 */
107export function dataSlice(data, start, end) {
108 const bytes = getBytes(data);
109 if (end != null && end > bytes.length) {
110 assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
111 buffer: bytes, length: bytes.length, offset: end
112 });
113 }
114 return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end));
115}
116/**
117 * Return the [[DataHexString]] result by stripping all **leading**
118 ** zero bytes from %%data%%.

Callers 15

#callMethod · 0.90
_parseBytesFunction · 0.90
parseOffchainLookupFunction · 0.90
encodeBase58CheckFunction · 0.90
constructorMethod · 0.90
constructorMethod · 0.90
decodeErrorResultMethod · 0.90
decodeFunctionDataMethod · 0.90
parseErrorMethod · 0.90
getCreateAddressFunction · 0.90
getCreate2AddressFunction · 0.90

Calls 4

assertFunction · 0.90
getBytesFunction · 0.70
hexlifyFunction · 0.70
sliceMethod · 0.45

Tested by

no test coverage detected