You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By contrast if you do these tests with an object containing "1a" as a key, it works as expected. That would be a reasonable workaround in some cases. Another workaround would be using Object.keys (which works fine) and then programmatically accessing the object within a loop, which is what I'll probably do for now.
Use case: Using an object as a map where the key is a numeric ID.
I would normally try to submit a fix, but I am super shaky on C and am pretty new to Espruino and javascript interpreters in general. If I can work it out I would be happy to open a PR but it's a little over my head at the moment.
The text was updated successfully, but these errors were encountered:
A change went in recently to ensure that Object.keys/etc always returned array indexes as strings to be spec compliant, and I bet that broke this. Hopefully quite an easy fix though...
I'm not sure about the theoretical minimal reproduction case but this is the best I have:
Espruino Web IDE - Left hand side:
Enter:
Object.entries({"1": "Hello"})
Expected result:
[ [ "1", "Hello" ] ]
Actual result:
[ [ "1", undefined ] ]
Enter:
Object.values({"1": "Hello"})
Expected result:
[ "Hello" ]
Actual result:
[ undefined ]
By contrast if you do these tests with an object containing "1a" as a key, it works as expected. That would be a reasonable workaround in some cases. Another workaround would be using Object.keys (which works fine) and then programmatically accessing the object within a loop, which is what I'll probably do for now.
Use case: Using an object as a map where the key is a numeric ID.
Suspected root cause: ae66489
I would normally try to submit a fix, but I am super shaky on C and am pretty new to Espruino and javascript interpreters in general. If I can work it out I would be happy to open a PR but it's a little over my head at the moment.
The text was updated successfully, but these errors were encountered: