Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/refactor common helper (#6251)

Thomas Kaul5de2b02a04bb
diff --git a/libs/common/src/lib/helper.ts b/libs/common/src/lib/helper.ts
index 9ee7d62206..4db1fcf2d0 100644
--- a/libs/common/src/lib/helper.ts
+++ b/libs/common/src/lib/helper.ts
@@ -223,8 +223,8 @@ export function getDateFormatString(aLocale?: string) {
);
return formatObject
- .map((object) => {
- switch (object.type) {
+ .map(({ type, value }) => {
+ switch (type) {
case 'day':
return 'dd';
case 'month':
@@ -232,7 +232,7 @@ export function getDateFormatString(aLocale?: string) {
case 'year':
return 'yyyy';
default:
- return object.value;
+ return value;
}
})
.join('');
@@ -271,8 +271,8 @@ export function getLowercase(object: object, path: string) {
export function getNumberFormatDecimal(aLocale?: string) {
const formatObject = new Intl.NumberFormat(aLocale).formatToParts(9999.99);
- return formatObject.find((object) => {
- return object.type === 'decimal';
+ return formatObject.find(({ type }) => {
+ return type === 'decimal';
})?.value;
}
@@ -281,8 +281,8 @@ export function getNumberFormatGroup(aLocale = getLocale()) {
useGrouping: true
}).formatToParts(9999.99);
- return formatObject.find((object) => {
- return object.type === 'group';
+ return formatObject.find(({ type }) => {
+ return type === 'group';
})?.value;
}