main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
962 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var globalThis = require('../internals/global-this');
|
---|
3 | var fails = require('../internals/fails');
|
---|
4 | var uncurryThis = require('../internals/function-uncurry-this');
|
---|
5 | var toString = require('../internals/to-string');
|
---|
6 | var trim = require('../internals/string-trim').trim;
|
---|
7 | var whitespaces = require('../internals/whitespaces');
|
---|
8 |
|
---|
9 | var $parseInt = globalThis.parseInt;
|
---|
10 | var Symbol = globalThis.Symbol;
|
---|
11 | var ITERATOR = Symbol && Symbol.iterator;
|
---|
12 | var hex = /^[+-]?0x/i;
|
---|
13 | var exec = uncurryThis(hex.exec);
|
---|
14 | var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
|
---|
15 | // MS Edge 18- broken with boxed symbols
|
---|
16 | || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));
|
---|
17 |
|
---|
18 | // `parseInt` method
|
---|
19 | // https://tc39.es/ecma262/#sec-parseint-string-radix
|
---|
20 | module.exports = FORCED ? function parseInt(string, radix) {
|
---|
21 | var S = trim(toString(string));
|
---|
22 | return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));
|
---|
23 | } : $parseInt;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.