Files
discord-decomp/sources/modules/parent_tools/SpendingLimitUtils.tsx
T
2026-07-27 16:20:00 +03:00

104 lines
4.0 KiB
TypeScript

/* Metro module 13350; source: modules/parent_tools/SpendingLimitUtils.tsx; dependencies: [2] */
function _fun101669(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#101669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13540:6, offset: 0x0221b831, size: 126 bytes, params: 8, frame: 16
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/parent_tools/SpendingLimitUtils.tsx');
exports.spendingLimitEqual = function(a0, a1) {
var r0;
var r1;
r0 = a0 == null && a1 == null;
if (!r0) {
r1 = a0 != null && a1 != null;
r1 = r1 && (a0.amount === a1.amount && a0.currency === a1.currency);
r0 = r1;
}
return r0;
};
exports.getNextRenewalDateLabel = getNextRenewalDateLabel;
exports.getCurrencySymbol = getCurrencySymbol;
exports.sanitizeAmountInput = sanitizeAmountInput;
}
function getNextRenewalDateLabel() { // fn#101671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13540:341, offset: 0x0221b8fe, size: 160 bytes, params: 1, frame: 17
let Date = global.Date;
let date = new Date();
Date = global.Date;
const Date2 = global.Date;
const UTC = Date2.UTC;
const uTCFullYear = date.getUTCFullYear();
date = date.getUTCMonth();
date = Reflect.apply(UTC, Date2, [uTCFullYear, date + 1, 1]);
date = new Date(date);
const Intl = global.Intl;
const DateTimeFormat = Intl.DateTimeFormat;
const value4 = Object.create(DateTimeFormat.prototype, {constructor: {value: DateTimeFormat}});
const dateTimeFormat = new DateTimeFormat(undefined, {'dateStyle': 'short', 'timeZone': 'UTC'});
return (dateTimeFormat instanceof Object ? dateTimeFormat : value4).format(date);
}
function getCurrencySymbol(a0) { // fn#101672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13540:557, offset: 0x0221b99e, size: 170 bytes, params: 2, frame: 17
var r1;
var Intl;
var NumberFormat;
var object2;
var value2;
var prototype;
var value3;
var numberFormat;
var value4;
var value5;
var closure;
var value6;
var value7;
var error;
let value = undefined;
try {
Intl = global.Intl;
NumberFormat = Intl.NumberFormat;
object2 = {style: 'currency'};
value2 = a0.toUpperCase();
object2.currency = value2;
prototype = NumberFormat.prototype;
value3 = Object.create(prototype, {constructor: {value: NumberFormat}});
numberFormat = new NumberFormat(value);
value4 = numberFormat instanceof Object ? numberFormat : value3;
value5 = value4.formatToParts(0);
closure = function(a0) {
return a0.type === 'currency';
};
value6 = value5.find(closure);
value7 = value6 == null;
r1 = value7 ? value : value6.value;
value = r1 != null;
if (!value) {
value = a0.toUpperCase();
r1 = value;
}
} catch (error) {
return a0.toUpperCase();
}
return r1;
}
function sanitizeAmountInput(a0, a1) { // fn#101674, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13540:837, offset: 0x0221ba5a, size: 155 bytes, params: 3, frame: 20
var r0;
var property;
if (a1 === 0) {
return a0.replace(RegExp('[^0-9]', 'g'), '');
}
let value = a0.replace(RegExp('[^0-9.]', 'g'), '');
const value2 = value.split('.');
if (value2.length === 1) {
r0 = value;
} else {
property = value2[0];
value = value2.slice(1);
value = value.join('');
value = value.slice(0, a1);
value = '' + property + '.' + value;
r0 = value;
}
return r0;
}