1 | 'use strict';
|
2 | var $ = require('../internals/export');
|
3 | var uncurryThis = require('../internals/function-uncurry-this');
|
4 | var fails = require('../internals/fails');
|
5 | var thisNumberValue = require('../internals/this-number-value');
|
6 |
|
7 | var nativeToPrecision = uncurryThis(1.0.toPrecision);
|
8 |
|
9 | var FORCED = fails(function () {
|
10 |
|
11 | return nativeToPrecision(1, undefined) !== '1';
|
12 | }) || !fails(function () {
|
13 |
|
14 | nativeToPrecision({});
|
15 | });
|
16 |
|
17 |
|
18 |
|
19 | $({ target: 'Number', proto: true, forced: FORCED }, {
|
20 | toPrecision: function toPrecision(precision) {
|
21 | return precision === undefined
|
22 | ? nativeToPrecision(thisNumberValue(this))
|
23 | : nativeToPrecision(thisNumberValue(this), precision);
|
24 | }
|
25 | });
|