/* eslint-disable no-console */ "use strict"; try { const object = { nil: null, integer: 1, float: Math.PI, string: "Hello, world!", binary: Uint8Array.from([1, 2, 3]), array: [10, 20, 30], map: { foo: "bar" }, timestampExt: new Date(), }; document.writeln("

input:

"); document.writeln(`
${JSON.stringify(object, undefined, 2)}
`); const encoded = MessagePack.encode(object); document.writeln("

output:

"); document.writeln(`
${JSON.stringify(MessagePack.decode(encoded), undefined, 2)}
`); } catch (e) { console.error(e); document.write(`

${e.constructor.name}: ${e.message}

`); }