Skip to content

Instantly share code, notes, and snippets.

@StevenLooman
Created October 5, 2012 14:13
Show Gist options
  • Save StevenLooman/3840006 to your computer and use it in GitHub Desktop.
Save StevenLooman/3840006 to your computer and use it in GitHub Desktop.
parseInt which throws an error when string is not parsable
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