(data, length, left)
| 125 | return "0x" + bytes; |
| 126 | } |
| 127 | function zeroPad(data, length, left) { |
| 128 | const bytes = getBytes(data); |
| 129 | assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { |
| 130 | buffer: new Uint8Array(bytes), |
| 131 | length: length, |
| 132 | offset: length + 1 |
| 133 | }); |
| 134 | const result = new Uint8Array(length); |
| 135 | result.fill(0); |
| 136 | if (left) { |
| 137 | result.set(bytes, length - bytes.length); |
| 138 | } |
| 139 | else { |
| 140 | result.set(bytes, 0); |
| 141 | } |
| 142 | return hexlify(result); |
| 143 | } |
| 144 | /** |
| 145 | * Return the [[DataHexString]] of %%data%% padded on the **left** |
| 146 | * to %%length%% bytes. |
no test coverage detected
searching dependent graphs…