* 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)
| 115 | * By default %%start%% is 0 and %%end%% is the length of %%data%%. |
| 116 | */ |
| 117 | function 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 | } |
| 126 | exports.dataSlice = dataSlice; |
| 127 | /** |
| 128 | * Return the [[DataHexString]] result by stripping all **leading** |