Skip to content

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

@MZanggl

Description

@MZanggl

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())
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions