fix infinity in json stringify

This commit is contained in:
2023-03-15 16:48:47 +00:00
parent ebc3df801b
commit b53f2b4a0a
15 changed files with 471 additions and 461 deletions

View File

@@ -42,9 +42,8 @@ func init() {
switch y := v.(type) {
case ArArray:
if len(y) == 2 {
keytype := typeof(y[0])
if keytype == "array" || keytype == "map" {
return nil, ArErr{TYPE: "TypeError", message: "Cannot use unhashable value as key: " + keytype, EXISTS: true}
if isUnhashable(y[0]) {
return nil, ArErr{TYPE: "TypeError", message: "Cannot use unhashable value as key: " + typeof(y[0]), EXISTS: true}
}
newmap[y[0]] = y[1]
continue