DEV Community

Calin Baenen
Calin Baenen

Posted on

⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️

A new commit to the ParseJS GitHub repository was made.

It fixes a critical bug related to the output the function returned.

The intended behavior.

parse_string usually returns an array that contains either a length-one-string (char) or symbol.
A symbol is inserted into the returned array IF a symbol is found. - I.e. if you pass the arguments: "test + test", ["test"] two symbols containing the description test will be inserted.
Otherwise, if a valid token isn't found, it will insert the current character

So, all together, if you pass in "test + test", ["test"], you should (and WILL) get [Symbol(test), ' ', '+', ' ', Symbol(test)].

The bug.

The bug is that "ghost" characters would be inserted into the output array if a token candidate didn't match the potential token in the string.

A visual demonstration of the bug.

This is a before and after of the bug fix:
Before update.
After update.

Thanks for your attention!
Cheers!

Top comments (0)