@molopos/shared 2.0.44 → 2.0.46

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 CHANGED
@@ -140,7 +140,13 @@ export declare enum ActivityModelEnum {
140
140
  NoteDelete = "NOTE_DELETE",
141
141
  SubscriptionCreate = "SUBSCRIPTION_CREATE",
142
142
  SubscriptionUpdate = "SUBSCRIPTION_UPDATE",
143
- SubscriptionDelete = "SUBSCRIPTION_DELETE"
143
+ SubscriptionDelete = "SUBSCRIPTION_DELETE",
144
+ SubCategoryCreate = "SUBCATEGORY_CREATE",
145
+ SubCategoryUpdate = "SUBCATEGORY_UPDATE",
146
+ SubCategoryDelete = "SUBCATEGORY_DELETE",
147
+ CustomerCreate = "CUSTOMER_CREATE",
148
+ CustomerUpdate = "CUSTOMER_UPDATE",
149
+ CustomerDelete = "CUSTOMER_DELETE"
144
150
  }
145
151
  /**
146
152
  * Transaction direction enum
package/enum/index.js CHANGED
@@ -150,6 +150,12 @@ var ActivityModelEnum;
150
150
  ActivityModelEnum["SubscriptionCreate"] = "SUBSCRIPTION_CREATE";
151
151
  ActivityModelEnum["SubscriptionUpdate"] = "SUBSCRIPTION_UPDATE";
152
152
  ActivityModelEnum["SubscriptionDelete"] = "SUBSCRIPTION_DELETE";
153
+ ActivityModelEnum["SubCategoryCreate"] = "SUBCATEGORY_CREATE";
154
+ ActivityModelEnum["SubCategoryUpdate"] = "SUBCATEGORY_UPDATE";
155
+ ActivityModelEnum["SubCategoryDelete"] = "SUBCATEGORY_DELETE";
156
+ ActivityModelEnum["CustomerCreate"] = "CUSTOMER_CREATE";
157
+ ActivityModelEnum["CustomerUpdate"] = "CUSTOMER_UPDATE";
158
+ ActivityModelEnum["CustomerDelete"] = "CUSTOMER_DELETE";
153
159
  })(ActivityModelEnum || (exports.ActivityModelEnum = ActivityModelEnum = {}));
154
160
  /**
155
161
  * Transaction direction enum
@@ -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 {};
@@ -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;
@@ -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.44","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"}}
1
+ {"name":"@molopos/shared","publishConfig":{"access":"public"},"version":"2.0.46","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"}}