beve icon indicating copy to clipboard operation
beve copied to clipboard

TypeError: Cannot convert undefined or null to object

Open meftunca opened this issue 7 months ago • 1 comments

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

meftunca avatar Jun 24 '24 10:06 meftunca