kriszyp / msgpackr

Ultra-fast MessagePack implementation with extension for record and structural cloning / msgpack.org[JavaScript/NodeJS]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

packing a `function` returns the same as packing `undefined`

Nokel81 opened this issue · comments

Description:

If I run the following code

import { Packr } from "msgpackr";

const packer = new Packr({
  moreTypes: true,
});

const data = packer.unpack(packer.pack(() => 10));

console.log(data); // undefined

I would have expected that it should throw, or at least give me the option to have it throw

This is available with the writeFunction option. Added this to the docs.

Ah excellent, thanks!