msgpack-lite
msgpack-lite copied to clipboard
usemaps gives undefined instead
I'm looking into this for the base of my library. I have no control over what data I need to handle later on, other as the requirement "All js types should be supported"
import { encode, decode, createCodec } from 'msgpack-lite';
const options = { codec: createCodec({ usemap: true, preset: true }) };
const test = Array.from({ length: 10 }, (e, i) => ({
name: i + ' sander',
dob: new Date(1900, 4, 14),
stuff: new Map<any, any>([
[1, [2, 4, 5, 7, 2, 4]],
['blah', false],
[{ a: 'b' }, { a: 'hi' }],
[3, 4],
['somestring', 'anotherString']
]),
tags: new Set(['a', 'b', 'dd'])
}));
const enc = encode(test, options);
const dec = decode(enc, options);
result:
I know set's are not supported out of the box, and will add my own extension for that, but this issue is blocking me now. Is there a mistake in my code?