Created
April 30, 2013 02:04
-
-
Save zootella/5486195 to your computer and use it in GitHub Desktop.
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
function _number(s, base) { | |
if (typeof s !== "string") throw "type"; | |
var n = parseInt(s, base); | |
if (isNaN(n)) throw "data"; | |
if (!match(_numerals(n, base), s)) throw "data"; // Guard against parseInt's dangerously accommodating parsing style by ensuring that the number we made becomes the same text we made it from | |
return n; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment