Add the new variable `FileProcessorFormField::$bigPreview` with getter and setter.
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / WoltLabSuite / Core / NumberUtil.js
CommitLineData
ad35859f
TD
1/**
2 * Provides helper functions for Number handling.
f73a2744
AE
3 *
4 * @author Tim Duesterhus
8b4089de 5 * @copyright 2001-2022 WoltLab GmbH
f73a2744 6 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
8b4089de 7 * @deprecated 6.0 All functionality in this module is deprecated.
ad35859f 8 */
f73a2744
AE
9define(["require", "exports"], function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.round = void 0;
13 /**
8b4089de 14 * @deprecated 6.0 Use `Number.toLocaleString()` or `Number.toFixed()` as appropriate.
f73a2744
AE
15 */
16 function round(value, exp) {
17 // If the exp is undefined or zero...
6ab9b916 18 if (typeof exp === "undefined" || +exp === 0) {
f73a2744
AE
19 return Math.round(value);
20 }
21 value = +value;
22 exp = +exp;
23 // If the value is not a number or the exp is not an integer...
6ab9b916 24 if (isNaN(value) || !(typeof exp === "number" && exp % 1 === 0)) {
f73a2744
AE
25 return NaN;
26 }
27 // Shift
6ab9b916 28 let tmp = value.toString().split("e");
665fa171
AE
29 let exponent = tmp[1] ? +tmp[1] - exp : -exp;
30 value = Math.round(+`${tmp[0]}e${exponent}`);
f73a2744 31 // Shift back
6ab9b916 32 tmp = value.toString().split("e");
665fa171
AE
33 exponent = tmp[1] ? +tmp[1] + exp : exp;
34 return +`${tmp[0]}e${exponent}`;
f73a2744
AE
35 }
36 exports.round = round;
ad35859f 37});