@molopos/shared 2.0.43 → 2.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/enum/index.d.ts +9 -2
- package/enum/index.js +7 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +17 -1
- package/lib/utils/index.test.js +6 -0
- package/package.json +1 -1
package/enum/index.d.ts
CHANGED
|
@@ -69,7 +69,8 @@ export declare enum QueryTypeEnum {
|
|
|
69
69
|
Organization = "ORGANIZATION",
|
|
70
70
|
Advancement = "ADVANCEMENT",
|
|
71
71
|
ApplicationSection = "APPLICATIONSECTION",
|
|
72
|
-
CollaborativeFund = "COLLABORATIVEFUND"
|
|
72
|
+
CollaborativeFund = "COLLABORATIVEFUND",
|
|
73
|
+
Subscription = "SUBSCRIPTION"
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
75
76
|
* Activity model enum
|
|
@@ -136,7 +137,13 @@ export declare enum ActivityModelEnum {
|
|
|
136
137
|
TaskDelete = "TASK_DELETE",
|
|
137
138
|
NoteCreate = "NOTE_CREATE",
|
|
138
139
|
NoteUpdate = "NOTE_UPDATE",
|
|
139
|
-
NoteDelete = "NOTE_DELETE"
|
|
140
|
+
NoteDelete = "NOTE_DELETE",
|
|
141
|
+
SubscriptionCreate = "SUBSCRIPTION_CREATE",
|
|
142
|
+
SubscriptionUpdate = "SUBSCRIPTION_UPDATE",
|
|
143
|
+
SubscriptionDelete = "SUBSCRIPTION_DELETE",
|
|
144
|
+
SubCategoryCreate = "SUBCATEGORY_CREATE",
|
|
145
|
+
SubCategoryUpdate = "SUBCATEGORY_UPDATE",
|
|
146
|
+
SubCategoryDelete = "SUBCATEGORY_DELETE"
|
|
140
147
|
}
|
|
141
148
|
/**
|
|
142
149
|
* Transaction direction enum
|
package/enum/index.js
CHANGED
|
@@ -78,6 +78,7 @@ var QueryTypeEnum;
|
|
|
78
78
|
QueryTypeEnum["Advancement"] = "ADVANCEMENT";
|
|
79
79
|
QueryTypeEnum["ApplicationSection"] = "APPLICATIONSECTION";
|
|
80
80
|
QueryTypeEnum["CollaborativeFund"] = "COLLABORATIVEFUND";
|
|
81
|
+
QueryTypeEnum["Subscription"] = "SUBSCRIPTION";
|
|
81
82
|
})(QueryTypeEnum || (exports.QueryTypeEnum = QueryTypeEnum = {}));
|
|
82
83
|
/**
|
|
83
84
|
* Activity model enum
|
|
@@ -146,6 +147,12 @@ var ActivityModelEnum;
|
|
|
146
147
|
ActivityModelEnum["NoteCreate"] = "NOTE_CREATE";
|
|
147
148
|
ActivityModelEnum["NoteUpdate"] = "NOTE_UPDATE";
|
|
148
149
|
ActivityModelEnum["NoteDelete"] = "NOTE_DELETE";
|
|
150
|
+
ActivityModelEnum["SubscriptionCreate"] = "SUBSCRIPTION_CREATE";
|
|
151
|
+
ActivityModelEnum["SubscriptionUpdate"] = "SUBSCRIPTION_UPDATE";
|
|
152
|
+
ActivityModelEnum["SubscriptionDelete"] = "SUBSCRIPTION_DELETE";
|
|
153
|
+
ActivityModelEnum["SubCategoryCreate"] = "SUBCATEGORY_CREATE";
|
|
154
|
+
ActivityModelEnum["SubCategoryUpdate"] = "SUBCATEGORY_UPDATE";
|
|
155
|
+
ActivityModelEnum["SubCategoryDelete"] = "SUBCATEGORY_DELETE";
|
|
149
156
|
})(ActivityModelEnum || (exports.ActivityModelEnum = ActivityModelEnum = {}));
|
|
150
157
|
/**
|
|
151
158
|
* Transaction direction enum
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -43,4 +43,9 @@ export declare const formatPercent: ({ value, locale, }: {
|
|
|
43
43
|
value: number;
|
|
44
44
|
locale: string;
|
|
45
45
|
}) => string;
|
|
46
|
+
/**
|
|
47
|
+
* @example
|
|
48
|
+
* capitalizeFirstLetter("john doe") // "John Doe"
|
|
49
|
+
*/
|
|
50
|
+
export declare const capitalizeFirstLetter: (value: string) => string;
|
|
46
51
|
export {};
|
package/lib/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatPercent = exports.formatePrice = exports.calculDiscount = exports.calculVat = exports.toCents = exports.fromCents = void 0;
|
|
3
|
+
exports.capitalizeFirstLetter = exports.formatPercent = exports.formatePrice = exports.calculDiscount = exports.calculVat = exports.toCents = exports.fromCents = void 0;
|
|
4
4
|
const isNaNumber = (value) => (!isNaN(Number(value)) ? value : 0);
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
@@ -56,3 +56,19 @@ const formatPercent = ({ value, locale, }) => {
|
|
|
56
56
|
return result;
|
|
57
57
|
};
|
|
58
58
|
exports.formatPercent = formatPercent;
|
|
59
|
+
/**
|
|
60
|
+
* @example
|
|
61
|
+
* capitalizeFirstLetter("john doe") // "John Doe"
|
|
62
|
+
*/
|
|
63
|
+
const capitalizeFirstLetter = (value) => {
|
|
64
|
+
// Séparer le nom complet en parties (prénom et nom)
|
|
65
|
+
const parties = value === null || value === void 0 ? void 0 : value.split(" ");
|
|
66
|
+
// Appliquer la capitalisation à chaque partie
|
|
67
|
+
if ((parties === null || parties === void 0 ? void 0 : parties.length) > 0) {
|
|
68
|
+
const partiesFormatees = parties === null || parties === void 0 ? void 0 : parties.map((item) => (item === null || item === void 0 ? void 0 : item.charAt(0).toUpperCase()) + (item === null || item === void 0 ? void 0 : item.slice(1).toLowerCase()));
|
|
69
|
+
// Rejoindre les parties avec un espace
|
|
70
|
+
return partiesFormatees.join(" ");
|
|
71
|
+
}
|
|
72
|
+
return "";
|
|
73
|
+
};
|
|
74
|
+
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
package/lib/utils/index.test.js
CHANGED
|
@@ -30,4 +30,10 @@ describe("Utils", () => {
|
|
|
30
30
|
const result = (0, index_1.formatPercent)({ value: 20, locale: "fr" });
|
|
31
31
|
expect(result).not.toBeNull();
|
|
32
32
|
});
|
|
33
|
+
test("capitalizeFirstLetter", () => {
|
|
34
|
+
const result = (0, index_1.capitalizeFirstLetter)("john doe");
|
|
35
|
+
expect(result).not.toBeNull();
|
|
36
|
+
expect(result).toBeDefined();
|
|
37
|
+
expect(result).toEqual("John Doe");
|
|
38
|
+
});
|
|
33
39
|
});
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.
|
|
1
|
+
{"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.45","description":"Shared between backend and frontend repos","license":"ISC","repository":{"type":"git","url":"https://github.com/unicubate/molopos-shared.git"},"dependencies":{"class-transformer":"^0.5.1","date-fns":"^4.4.0","luxon":"^3.7.2"}}
|