Created
June 12, 2015 16:21
-
-
Save Zirak/d8f40d8101eecba36dea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function shouldParenthesize (code) { | |
| try { | |
| Function(code); | |
| } | |
| catch (e) { | |
| if (e instanceof SyntaxError) { | |
| try { | |
| Function('(' + code + ')'); | |
| return true; | |
| } | |
| catch (_) {} | |
| } | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment