(data, start, end)
| 105 | * By default %%start%% is 0 and %%end%% is the length of %%data%%. |
| 106 | */ |
| 107 | export 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%%. |
no test coverage detected