Wikibase quantity number parsing happens in QuantityParser.php and the tests are in QuantityParserTest.php.
Consider implementing this in an extra class or file. That would make the transition to a javascript version of the Number repo easier in the future.
NOTE: We (and Wikibase) _do not_ parse the quantity from the number string. But everything else seems accurate, including 100! and 100~. I still have to find where the numbers are translated from their localized version to their conceptual representation.
NOTE: We (for now) do not parse any numerals except 0-9 and also expect the dot . to be the decimal separator.