Created
October 5, 2012 14:13
-
-
Save StevenLooman/3840006 to your computer and use it in GitHub Desktop.
parseInt which throws an error when string is not parsable
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 (string, radix) { | |
var result = window._parseInt(string, radix); | |
if (isNaN(result)) { | |
throw new Error('Unable to parse int'); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment