(object)
| 12 | return result; |
| 13 | } |
| 14 | function _encode(object) { |
| 15 | if (Array.isArray(object)) { |
| 16 | let payload = []; |
| 17 | object.forEach(function (child) { |
| 18 | payload = payload.concat(_encode(child)); |
| 19 | }); |
| 20 | if (payload.length <= 55) { |
| 21 | payload.unshift(0xc0 + payload.length); |
| 22 | return payload; |
| 23 | } |
| 24 | const length = arrayifyInteger(payload.length); |
| 25 | length.unshift(0xf7 + length.length); |
| 26 | return length.concat(payload); |
| 27 | } |
| 28 | const data = Array.prototype.slice.call((0, data_js_1.getBytes)(object, "object")); |
| 29 | if (data.length === 1 && data[0] <= 0x7f) { |
| 30 | return data; |
| 31 | } |
| 32 | else if (data.length <= 55) { |
| 33 | data.unshift(0x80 + data.length); |
| 34 | return data; |
| 35 | } |
| 36 | const length = arrayifyInteger(data.length); |
| 37 | length.unshift(0xb7 + length.length); |
| 38 | return length.concat(data); |
| 39 | } |
| 40 | const nibbles = "0123456789abcdef"; |
| 41 | /** |
| 42 | * Encodes %%object%% as an RLP-encoded [[DataHexString]]. |
no test coverage detected