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

Calling methods on proxied Buffer crashes with error "TypeError: argument must be a buffer" #42

Open
MZanggl opened this issue Dec 29, 2020 · 1 comment

Comments

@MZanggl
Copy link

MZanggl commented Dec 29, 2020

If you use an object that contains a buffer (for example _id coming from MongoDB), calling methods like toString crash with the error "TypeError: argument must be a buffer".

Here is a test that verifies this:

it("Proxied Buffer.toString outputs the pristine Buffer.toString", async (assert) => {
    const model = { id: Buffer.from("5fea9621e6efdf282752f5ba") };
    const proxy = ObservableSlim.create(model);

    expect(proxy.id.toString()).to.equal(model.id.toString())
});
@ElliotNB
Copy link
Owner

@MZanggl My apologies for not seeing this until now! I'll take a look into this to see what can be done. However, Observable-Slim in general is intended to be used with "plain" objects. Specialized objects like Date even have trouble with native Proxy functionality let alone Observable-Slim.

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