77 lines
3.5 KiB
TypeScript
77 lines
3.5 KiB
TypeScript
/* Metro module 1856; source: utils/NumberUtils.tsx; dependencies: [1244, 2] */
|
|
function _fun20018(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#20018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1983:6, offset: 0x00ebc806, size: 127 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/NumberUtils.tsx');
|
|
exports.shortenAndLocalizeNumber = shortenAndLocalizeNumber;
|
|
exports.humanizeValue = humanizeValue;
|
|
exports.parseInteger = function(a0) {
|
|
var r0;
|
|
var value = a1;
|
|
r0 = value !== undefined ? value : global.NaN;
|
|
if (a0 == null) {
|
|
return r0;
|
|
}
|
|
value = (0, global.parseInt)(a0);
|
|
return global.Number.isNaN(value) ? r0 : value;
|
|
};
|
|
exports.formatPercent = function(a0, a1) {
|
|
var r0;
|
|
var object;
|
|
var value = a2;
|
|
r0 = value !== undefined ? value : {};
|
|
var Intl = global.Intl;
|
|
object = {'style': 'percent', 'minimumFractionDigits': 0};
|
|
copyDataProperties(object, r0, Intl);
|
|
return Intl.NumberFormat(a0, object).format(a1);
|
|
};
|
|
}
|
|
|
|
function shortenAndLocalizeNumber(a0) { // fn#20019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1983:184, offset: 0x00ebc885, size: 167 bytes, params: 2, frame: 17
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
if (a0 < 1000000) {
|
|
return intl.formatToPlainString(t.OiHat3, {value: a0});
|
|
}
|
|
let value = a0 / 1000000;
|
|
value = value.toFixed(1);
|
|
const formatToPlainString = intl.formatToPlainString;
|
|
const Iku48I = t.Iku48I;
|
|
return Reflect.apply(formatToPlainString, intl, [Iku48I, {value: value}]);
|
|
}
|
|
|
|
function humanizeValue(a0, a1) { // fn#20020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1983:404, offset: 0x00ebc92c, size: 369 bytes, params: 3, frame: 18
|
|
var object2;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var formatToPlainString;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var property;
|
|
var OiHat3;
|
|
if (a0 < 1000) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
OiHat3 = t.OiHat3;
|
|
object2 = {};
|
|
object2.value = global.Math.floor(a0);
|
|
return Reflect.apply(formatToPlainString, intl, [OiHat3, object2]);
|
|
}
|
|
if (a0 < 1000000) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
property = t['84R4Tc'];
|
|
object2 = {};
|
|
object2.value = global.Math.floor(a0 / 1000);
|
|
return Reflect.apply(formatToPlainString, intl, [property, object2]);
|
|
}
|
|
const Math = global.Math;
|
|
let value = Math.floor(10 * a0 / 1000000) / 10;
|
|
const Intl = global.Intl;
|
|
const NumberFormat = Intl.NumberFormat;
|
|
const value2 = Object.create(NumberFormat.prototype, {constructor: {value: NumberFormat}});
|
|
const numberFormat = new NumberFormat(a1, {maximumFractionDigits: 1});
|
|
value = (numberFormat instanceof Object ? numberFormat : value2).format(value);
|
|
formatToPlainString = intl.formatToPlainString;
|
|
const Iku48I = t.Iku48I;
|
|
return Reflect.apply(formatToPlainString, intl, [Iku48I, {value: value}]);
|
|
}
|
|
|