dorey / JavaScript-Equality-Table

Creative Commons Attribution Share Alike 4.0 International
1.24k stars 193 forks source link

Wrap evalString with parens. #5

Closed erinishimoticha closed 10 years ago

erinishimoticha commented 10 years ago

Prior to this commit, we checked to see if asString was equal to '{}' because a syntax error would occur during eval on these comparisons. If we were comparing '{}', we'd wrap it in an array and access index 0 to get the result of the comparison after eval. Because this requirement is conditional, we had to modify evalString itself. This had the side effect of making the 'title' attribute contain the array representation as well, which is ugly. Instead, we can wrap every eval'ed string in parens. This does not change the return value but does mitigate the syntax error, and it does it in a way that does not change the title displayed in the table.

dorey commented 10 years ago

Parentheses! well that's definitely a cleaner way to do it.... Thanks