From 23b60dc1975db38c280d8a123aff97544d1673e0 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:34:21 +0800 Subject: [PATCH] TODO#139890 FAQ 常見問題 1-文案調整 --- PAMapp/node_modules/core-js/modules/es.number.to-fixed.js | 33 ++++++++++++++++++++------------- 1 files changed, 20 insertions(+), 13 deletions(-) diff --git a/PAMapp/node_modules/core-js/modules/es.number.to-fixed.js b/PAMapp/node_modules/core-js/modules/es.number.to-fixed.js index 0b9c5da..d54ffe5 100644 --- a/PAMapp/node_modules/core-js/modules/es.number.to-fixed.js +++ b/PAMapp/node_modules/core-js/modules/es.number.to-fixed.js @@ -1,12 +1,18 @@ 'use strict'; var $ = require('../internals/export'); +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 @@ 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 @@ -77,6 +83,7 @@ var result = '0'; var e, z, j, k; + // TODO: ES2018 increased the maximum number of fraction digits to 100, need to improve the implementation if (fractDigits < 0 || fractDigits > 20) throw RangeError('Incorrect fraction digits'); // eslint-disable-next-line no-self-compare -- NaN check if (number != number) return 'NaN'; @@ -110,14 +117,14 @@ } 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; -- Gitblit v1.8.0