⚠️ 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 sy…


This content originally appeared on DEV Community and was authored by Calin Baenen

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!


This content originally appeared on DEV Community and was authored by Calin Baenen


Print Share Comment Cite Upload Translate Updates
APA

Calin Baenen | Sciencx (2021-12-13T12:46:12+00:00) ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️. Retrieved from https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/

MLA
" » ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️." Calin Baenen | Sciencx - Monday December 13, 2021, https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/
HARVARD
Calin Baenen | Sciencx Monday December 13, 2021 » ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️., viewed ,<https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/>
VANCOUVER
Calin Baenen | Sciencx - » ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/
CHICAGO
" » ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️." Calin Baenen | Sciencx - Accessed . https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/
IEEE
" » ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️." Calin Baenen | Sciencx [Online]. Available: https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/. [Accessed: ]
rf:citation
» ⚠️ CRITICAL update for ParseJS/ParseTS! ⚠️ | Calin Baenen | Sciencx | https://www.scien.cx/2021/12/13/%e2%9a%a0%ef%b8%8f-critical-update-for-parsejs-parsets-%e2%9a%a0%ef%b8%8f/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.