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