main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
977 bytes
|
Rev | Line | |
---|
[79a0317] | 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 charAt = uncurryThis(''.charAt);
|
---|
| 10 | var $parseFloat = globalThis.parseFloat;
|
---|
| 11 | var Symbol = globalThis.Symbol;
|
---|
| 12 | var ITERATOR = Symbol && Symbol.iterator;
|
---|
| 13 | var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity
|
---|
| 14 | // MS Edge 18- broken with boxed symbols
|
---|
| 15 | || (ITERATOR && !fails(function () { $parseFloat(Object(ITERATOR)); }));
|
---|
| 16 |
|
---|
| 17 | // `parseFloat` method
|
---|
| 18 | // https://tc39.es/ecma262/#sec-parsefloat-string
|
---|
| 19 | module.exports = FORCED ? function parseFloat(string) {
|
---|
| 20 | var trimmedString = trim(toString(string));
|
---|
| 21 | var result = $parseFloat(trimmedString);
|
---|
| 22 | return result === 0 && charAt(trimmedString, 0) === '-' ? -0 : result;
|
---|
| 23 | } : $parseFloat;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.