d3x0r / JSON6

JSON for Humans (ES6)
Other
236 stars 14 forks source link

Weird Arrays #8

Closed croqaz closed 6 years ago

croqaz commented 6 years ago

Hi again,

I found a weird bug when parsing Arrays.

var JSON6 = require('json-6')
var d = '[ {a: "", b: ""}, {a: "", b: ""} ]'
var r = JSON6.parse(d)
// [ { a: '', b: '' }, <1 empty item>, { a: '', b: '' } ] //  <empty item> ???
Array.isArray(r)
// true
d3x0r commented 6 years ago

Yup; I see. Working on it.

d3x0r commented 6 years ago

Should be fixed test

croqaz commented 6 years ago

That solves it! Fantastic!

d3x0r commented 6 years ago

Was testing performance and found that 'let' can cause deoptimizations. FIxed to restore performance over json5.