You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
403 B
JavaScript
9 lines
403 B
JavaScript
var $parseInt = require('./_global').parseInt
|
|
, $trim = require('./_string-trim').trim
|
|
, ws = require('./_string-ws')
|
|
, hex = /^[\-+]?0[xX]/;
|
|
|
|
module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix){
|
|
var string = $trim(String(str), 3);
|
|
return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10));
|
|
} : $parseInt; |