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

Function dataSlice

lib.commonjs/utils/data.js:117–125  ·  view source on GitHub ↗

* Returns a [[DataHexString]] by slicing %%data%% from the %%start%% * offset to the %%end%% offset. * * By default %%start%% is 0 and %%end%% is the length of %%data%%.

(data, start, end)

Source from the content-addressed store, hash-verified

115 * By default %%start%% is 0 and %%end%% is the length of %%data%%.
116 */
117function dataSlice(data, start, end) {
118 const bytes = getBytes(data);
119 if (end != null && end > bytes.length) {
120 (0, errors_js_1.assert)(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
121 buffer: bytes, length: bytes.length, offset: end
122 });
123 }
124 return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end));
125}
126exports.dataSlice = dataSlice;
127/**
128 * Return the [[DataHexString]] result by stripping all **leading**

Callers

nothing calls this directly

Calls 3

getBytesFunction · 0.70
hexlifyFunction · 0.70
sliceMethod · 0.45

Tested by

no test coverage detected