Created
January 5, 2023 09:25
-
-
Save yairEO/9eaeeb7ab341fd8e91acb938b8a9f6af to your computer and use it in GitHub Desktop.
Safe javascript JSON.parse which never throws exceptions
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 = (JP => (...args) => { | |
try { return JP(...args) } catch{} | |
})(JSON.parse) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test Cases: