Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
605 bytes
|
Line | |
---|
1 | var global = require('../internals/global');
|
---|
2 | var toString = require('../internals/to-string');
|
---|
3 | var trim = require('../internals/string-trim').trim;
|
---|
4 | var whitespaces = require('../internals/whitespaces');
|
---|
5 |
|
---|
6 | var $parseInt = global.parseInt;
|
---|
7 | var hex = /^[+-]?0[Xx]/;
|
---|
8 | var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22;
|
---|
9 |
|
---|
10 | // `parseInt` method
|
---|
11 | // https://tc39.es/ecma262/#sec-parseint-string-radix
|
---|
12 | module.exports = FORCED ? function parseInt(string, radix) {
|
---|
13 | var S = trim(toString(string));
|
---|
14 | return $parseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
|
---|
15 | } : $parseInt;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.