Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packing a function returns the same as packing undefined #134

Closed
Nokel81 opened this issue Mar 27, 2024 · 2 comments
Closed

packing a function returns the same as packing undefined #134

Nokel81 opened this issue Mar 27, 2024 · 2 comments

Comments

@Nokel81
Copy link
Contributor

Nokel81 commented Mar 27, 2024

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

@kriszyp
Copy link
Owner

kriszyp commented May 11, 2024

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

@Nokel81
Copy link
Contributor Author

Nokel81 commented May 11, 2024

Ah excellent, thanks!

@Nokel81 Nokel81 closed this as completed May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants