X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fcore-js%2Fmodules%2Fes.number.to-fixed.js;h=dac971822df8716ee7e70f6a48d147db7b2ec01b;hb=3be0a9efc698a9570a44456009afc6014812625a;hp=806fd8efccf648f6167bd2b5ffa86e05af18539f;hpb=3c06164f15bd10aed7d66b6314764a2961a14762;p=dotfiles%2F.git diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.number.to-fixed.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.number.to-fixed.js index 806fd8ef..dac97182 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.number.to-fixed.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/modules/es.number.to-fixed.js @@ -1,12 +1,18 @@ 'use strict'; var $ = require('../internals/export'); -var toInteger = require('../internals/to-integer'); +var global = require('../internals/global'); +var uncurryThis = require('../internals/function-uncurry-this'); +var toIntegerOrInfinity = require('../internals/to-integer-or-infinity'); var thisNumberValue = require('../internals/this-number-value'); -var repeat = require('../internals/string-repeat'); +var $repeat = require('../internals/string-repeat'); var fails = require('../internals/fails'); -var nativeToFixed = 1.0.toFixed; +var RangeError = global.RangeError; +var String = global.String; var floor = Math.floor; +var repeat = uncurryThis($repeat); +var stringSlice = uncurryThis(''.slice); +var un$ToFixed = uncurryThis(1.0.toFixed); var pow = function (x, n, acc) { return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); @@ -51,19 +57,19 @@ var dataToString = function (data) { while (--index >= 0) { if (s !== '' || index === 0 || data[index] !== 0) { var t = String(data[index]); - s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t; + s = s === '' ? t : s + repeat('0', 7 - t.length) + t; } } return s; }; -var FORCED = nativeToFixed && ( - 0.00008.toFixed(3) !== '0.000' || - 0.9.toFixed(0) !== '1' || - 1.255.toFixed(2) !== '1.25' || - 1000000000000000128.0.toFixed(0) !== '1000000000000000128' -) || !fails(function () { +var FORCED = fails(function () { + return un$ToFixed(0.00008, 3) !== '0.000' || + un$ToFixed(0.9, 0) !== '1' || + un$ToFixed(1.255, 2) !== '1.25' || + un$ToFixed(1000000000000000128.0, 0) !== '1000000000000000128'; +}) || !fails(function () { // V8 ~ Android 4.3- - nativeToFixed.call({}); + un$ToFixed({}); }); // `Number.prototype.toFixed` method @@ -71,7 +77,7 @@ var FORCED = nativeToFixed && ( $({ target: 'Number', proto: true, forced: FORCED }, { toFixed: function toFixed(fractionDigits) { var number = thisNumberValue(this); - var fractDigits = toInteger(fractionDigits); + var fractDigits = toIntegerOrInfinity(fractionDigits); var data = [0, 0, 0, 0, 0, 0]; var sign = ''; var result = '0'; @@ -110,14 +116,14 @@ $({ target: 'Number', proto: true, forced: FORCED }, { } else { multiply(data, 0, z); multiply(data, 1 << -e, 0); - result = dataToString(data) + repeat.call('0', fractDigits); + result = dataToString(data) + repeat('0', fractDigits); } } if (fractDigits > 0) { k = result.length; result = sign + (k <= fractDigits - ? '0.' + repeat.call('0', fractDigits - k) + result - : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)); + ? '0.' + repeat('0', fractDigits - k) + result + : stringSlice(result, 0, k - fractDigits) + '.' + stringSlice(result, k - fractDigits)); } else { result = sign + result; } return result;