d3x0r / JSON6

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

node is undefined in unshift function. #12

Closed jdalton closed 6 years ago

jdalton commented 6 years ago

When upgrading I ran into a node is undefined error due to https://github.com/d3x0r/JSON6/blob/0e6e1912db47128cfd92d9e2c4acbeb44472ae56/lib/json6.js#L153-L159

d3x0r commented 6 years ago

Ahh sorry through all my tests I didn't run into that... Pushed/published a fix. do you have a sample that causes it?

jdalton commented 6 years ago

Not at the moment it was one of the .esmrc files in my test suite. What does unshift do here?

d3x0r commented 6 years ago

same as unshift on an array - removes the first element and returns it. Just reduced some garbage collection by keeping those around for reuse using a custom class instead. Unshift is used when it continues reading; like there was json that was finished, and there was more left to process afterward.

d3x0r commented 6 years ago

Fixed a long time ago :)