Created
May 13, 2014 13:10
-
-
Save mallowigi/8023b1cf35496ef54416 to your computer and use it in GitHub Desktop.
JSON parse polyfill
This file contains 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
JSON: | |
parse: (string) -> | |
if string[0] != "{" && string[0] != "[" | |
return null | |
else if window.JSON? | |
window.JSON.parse(string) | |
else | |
eval(string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment