Skip to content

Commit 25d2aa7

Browse files
committed
fixed unallowed names output
1 parent ba8d529 commit 25d2aa7

1 file changed

Lines changed: 23 additions & 19 deletions

File tree

src/functions/contacts/index.js

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export function generateRandomContact() {
77
separator: "",
88
}); // big_red_donkey
99

10-
return { uniqueName: randomName + Math.ceil(Math.random() * 99) };
10+
const cleanName = randomName.replace(/[^\p{L}\p{N}_]/gu, ""); //staralize output
11+
12+
return {
13+
uniqueName: cleanName + Math.ceil(Math.random() * 99),
14+
};
1115
}
1216

1317
export async function getBolt11InvoiceForContact(
@@ -16,7 +20,7 @@ export async function getBolt11InvoiceForContact(
1620
description,
1721
useBlitzContact = true,
1822
domain = "blitzwalletapp.com",
19-
sendingUUID
23+
sendingUUID,
2024
) {
2125
try {
2226
let runCount = 0;
@@ -55,37 +59,37 @@ export function getTimeDisplay(
5559
timeDifferenceMinutes,
5660
timeDifferenceHours,
5761
timeDifferenceDays,
58-
timeDifferenceYears
62+
timeDifferenceYears,
5963
) {
6064
const timeValue =
6165
timeDifferenceMinutes <= 60
6266
? timeDifferenceMinutes < 1
6367
? ""
6468
: Math.round(timeDifferenceMinutes)
6569
: timeDifferenceHours <= 24
66-
? Math.round(timeDifferenceHours)
67-
: timeDifferenceDays <= 365
68-
? Math.round(timeDifferenceDays)
69-
: Math.round(timeDifferenceYears);
70+
? Math.round(timeDifferenceHours)
71+
: timeDifferenceDays <= 365
72+
? Math.round(timeDifferenceDays)
73+
: Math.round(timeDifferenceYears);
7074

7175
const timeUnit =
7276
timeDifferenceMinutes <= 60
7377
? timeDifferenceMinutes < 1
7478
? i18next.t("transactionLabelText.txTime_just_now")
7579
: Math.round(timeDifferenceMinutes) === 1
76-
? i18next.t("timeLabels.minute")
77-
: i18next.t("timeLabels.minutes")
80+
? i18next.t("timeLabels.minute")
81+
: i18next.t("timeLabels.minutes")
7882
: timeDifferenceHours <= 24
79-
? Math.round(timeDifferenceHours) === 1
80-
? i18next.t("timeLabels.hour")
81-
: i18next.t("timeLabels.hours")
82-
: timeDifferenceDays <= 365
83-
? Math.round(timeDifferenceDays) === 1
84-
? i18next.t("timeLabels.day")
85-
: i18next.t("timeLabels.days")
86-
: Math.round(timeDifferenceYears) === 1
87-
? i18next.t("timeLabels.year")
88-
: i18next.t("timeLabels.years");
83+
? Math.round(timeDifferenceHours) === 1
84+
? i18next.t("timeLabels.hour")
85+
: i18next.t("timeLabels.hours")
86+
: timeDifferenceDays <= 365
87+
? Math.round(timeDifferenceDays) === 1
88+
? i18next.t("timeLabels.day")
89+
: i18next.t("timeLabels.days")
90+
: Math.round(timeDifferenceYears) === 1
91+
? i18next.t("timeLabels.year")
92+
: i18next.t("timeLabels.years");
8993

9094
const suffix =
9195
timeDifferenceMinutes > 1

0 commit comments

Comments
 (0)