Skip to content

TypeError: Cannot convert undefined or null to object #7

@meftunca

Description

@meftunca

JSON and most languages do not support undefined values, and this is how the write_beve function on beve js throws an error for the undefined value passed to it. This is a potential bug for the js. Something needs to be done about this.

Suggestion,

  1. remove Object values with undefined values (like browsers do in rest api requests)
  2. We can convert Array elements with undefined value to null

I was able to solve the problem by adding a new "if" branch under write_value.

else if (value === null) {
        let header = 0;
        header |= 0b00000000;
        writer.append_uint8(header);
    } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions