marcello3d / node-tosource

Converts JavaScript objects to source

Home Page:https://github.com/marcello3d/node-tosource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array with hole support

tiansh opened this issue · comments

Array with last element as a hole will generate wrong output.

eval(tosource(Array(3))).length // should be 3, but get 2 

How would you expect this to serialize?

Array(3) should be serialized to [, , ,].

ES2016 is a bit newer than I'm supporting… what's the browser support like?

Actually, this behavior had been defined in ES5 (I'm not sure what ES3 does say). IE 10+ and all other browsers support it. (IE <=9 is buggy)