(data: Uint8Array)
| 22 | * @returns Decoded value from the MessagePack binary data. |
| 23 | */ |
| 24 | export function decode(data: Uint8Array): ValueType { |
| 25 | const pointer = { consumed: 0 }; |
| 26 | const dataView = new DataView( |
| 27 | data.buffer, |
| 28 | data.byteOffset, |
| 29 | data.byteLength, |
| 30 | ); |
| 31 | const value = decodeSlice(data, dataView, pointer); |
| 32 | |
| 33 | if (pointer.consumed < data.length) { |
| 34 | throw new EvalError("Messagepack decode did not consume whole array"); |
| 35 | } |
| 36 | |
| 37 | return value; |
| 38 | } |
| 39 | |
| 40 | function decodeString( |
| 41 | uint8: Uint8Array, |
no test coverage detected