asv-hlps 1.3.10 → 1.3.11
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/lib/cjs/models/entities/bills/EBillPeriod.js +1 -1
- package/lib/cjs/models/entities/bills/EPayMethod.js +1 -1
- package/lib/cjs/models/entities/sales/enums/SaleTreatStatus.js +1 -1
- package/lib/cjs/models/shared/EInOutMotive.js +1 -1
- package/lib/cjs/utils.d.ts +2 -3
- package/lib/cjs/utils.js +27 -19
- package/lib/esm/utils.d.ts +2 -3
- package/lib/esm/utils.js +24 -15
- package/package.json +8 -6
|
@@ -7,4 +7,4 @@ var SaleTreatStatus;
|
|
|
7
7
|
SaleTreatStatus["PROCESSED"] = " trait\u00E9e";
|
|
8
8
|
SaleTreatStatus["DELIVERING"] = "en cours de livraison";
|
|
9
9
|
SaleTreatStatus["DELIVERED"] = "en livr\u00E9e";
|
|
10
|
-
})(SaleTreatStatus
|
|
10
|
+
})(SaleTreatStatus || (exports.SaleTreatStatus = SaleTreatStatus = {}));
|
|
@@ -12,4 +12,4 @@ var InOutMotive;
|
|
|
12
12
|
InOutMotive["TRANSFERT"] = "transfert";
|
|
13
13
|
InOutMotive["ON_EDIT"] = "modif stock";
|
|
14
14
|
InOutMotive["GHOST"] = "Fantome";
|
|
15
|
-
})(InOutMotive
|
|
15
|
+
})(InOutMotive || (exports.InOutMotive = InOutMotive = {}));
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -15,15 +15,14 @@ export declare const calPercent: (nbr: number, percentage: number) => number;
|
|
|
15
15
|
export declare const displayDateRangeFr: (getFromDate?: any, getToDate?: any) => string;
|
|
16
16
|
export declare const getNbOfDaysBetweenTwoDates: (date1: Date, date2: Date) => number;
|
|
17
17
|
export declare const getRandomColor: (brightness: number) => string;
|
|
18
|
-
export declare const removeDuplicates: (tab: any[]) => any[];
|
|
19
18
|
/**
|
|
20
19
|
* remove duplicates from array by crietere (key)
|
|
21
20
|
* @param tobs
|
|
22
21
|
* @param key
|
|
23
22
|
* @returns
|
|
24
23
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
24
|
+
export declare const removeDuplicateObjects: (array: any[], property?: string) => any[];
|
|
25
|
+
export declare const duplicateObjects: (array: any[], property: string) => any[];
|
|
27
26
|
export declare const toObjectDate: (fromDate: any, toDate: string) => {
|
|
28
27
|
fromDate: any;
|
|
29
28
|
toDate: string;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.dateToString = exports.replaceSpacesWith = exports.replaceAllIn = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeBackSlashOccurences = exports.removeString = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.reformatDates = exports.currencyFormatterCfa = exports.formatToStringCfa = exports.currencyFormatter = exports.formatToString = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.
|
|
7
|
-
exports.removeParamKeyName = exports.countryIsoToFlag = exports.dateFormatter = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit =
|
|
6
|
+
exports.unCheckedAll = exports.inputChecked = exports.arrayMultiChecked = exports.getPeriodDateColor = exports.getColorAccordingToDate = exports.genRandomColour = exports.formatNgbDate = exports.dateToString = exports.replaceSpacesWith = exports.replaceAllIn = exports.sesStorageGet = exports.sesStorageSet = exports.genSequenceRef = exports.removeBackSlashOccurences = exports.removeString = exports.deepClone = exports.findFirstSequenceMissing = exports.fillNumWithZero = exports.findSequencesMissing = exports.sequencesToNumbers = exports.notInSequence = exports.reformatDates = exports.currencyFormatterCfa = exports.formatToStringCfa = exports.currencyFormatter = exports.formatToString = exports.wakeUp = exports.sleep = exports.limitTo = exports.titleCase = exports.toObjectDate = exports.duplicateObjects = exports.removeDuplicateObjects = exports.getRandomColor = exports.getNbOfDaysBetweenTwoDates = exports.displayDateRangeFr = exports.calPercent = exports.percentOf = exports.genDateMinutesStep = exports.convertFrDateToEnDate = exports.convertEnDateToFr = exports.formatDateMd = exports.formatDateYm = exports.formatDateYmFirstDay = exports.formatDateYmd = exports.formatFromAndToDate = exports.formatDateYmHypen = exports.formatDateFirstDayFr = exports.formatDateYmdHypenFr = exports.formatDateYmdHypen = void 0;
|
|
7
|
+
exports.removeParamKeyName = exports.countryIsoToFlag = exports.dateFormatter = exports.monthStringName = exports.returnBool = exports.formatAmountToString = exports.reduceSum = exports.sumAmount = exports.fillEndWithZero = exports.fillStartWithZero = exports.absFromSequence = exports.returnDates = exports.displayFrDatePeriode = exports.getArrayOfRandomColor = exports.randomHslColor = exports.randomHexColor = exports.randomRgbColor = exports.randomInteger = exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = void 0;
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
9
10
|
require("dayjs/locale/fr");
|
|
10
11
|
const formatDateYmdHypen = (date) => {
|
|
11
12
|
return (0, exports.formatDateYmd)(date, "-");
|
|
@@ -116,33 +117,40 @@ const getRandomColor = (brightness) => {
|
|
|
116
117
|
return "rgb(" + mixedrgb.join(",") + ")";
|
|
117
118
|
};
|
|
118
119
|
exports.getRandomColor = getRandomColor;
|
|
119
|
-
const removeDuplicates = (tab) => {
|
|
120
|
-
|
|
121
|
-
};
|
|
122
|
-
exports.removeDuplicates = removeDuplicates;
|
|
120
|
+
/* export const removeDuplicates = (tab: any[]) => {
|
|
121
|
+
return tab.filter((v, i, a) => a.findIndex((t) => t.id === v.id && t.name === v.name) === i);
|
|
122
|
+
}; */
|
|
123
123
|
/**
|
|
124
124
|
* remove duplicates from array by crietere (key)
|
|
125
125
|
* @param tobs
|
|
126
126
|
* @param key
|
|
127
127
|
* @returns
|
|
128
128
|
*/
|
|
129
|
-
const removeDuplicatesByKey = (tobs, property) => {
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const uniqueIds = [];
|
|
129
|
+
/* export const removeDuplicatesByKey = (tobs: any[], property: string) => {
|
|
130
|
+
return [...new Map(tobs.map((item) => [item[property], item])).values()];
|
|
131
|
+
}; */
|
|
132
|
+
const removeDuplicateObjects = (array, property = "id") => {
|
|
133
|
+
return array.filter((obj, index) => array.findIndex((item) => lodash_1.default.get(item, property) === lodash_1.default.get(obj, property)) === index);
|
|
134
|
+
/* const uniqueIds: any[] = [];
|
|
135
135
|
const unique = array.filter((element) => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return
|
|
136
|
+
const isDuplicate = uniqueIds.includes(element[property]);
|
|
137
|
+
|
|
138
|
+
if (!isDuplicate) {
|
|
139
|
+
uniqueIds.push(element[property]);
|
|
140
|
+
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return false;
|
|
142
145
|
});
|
|
143
|
-
|
|
146
|
+
|
|
147
|
+
return unique; */
|
|
144
148
|
};
|
|
145
149
|
exports.removeDuplicateObjects = removeDuplicateObjects;
|
|
150
|
+
const duplicateObjects = (array, property) => {
|
|
151
|
+
return array.filter((obj, index) => array.findIndex((item) => lodash_1.default.get(item, property) === lodash_1.default.get(obj, property)) !== index);
|
|
152
|
+
};
|
|
153
|
+
exports.duplicateObjects = duplicateObjects;
|
|
146
154
|
const toObjectDate = (fromDate, toDate) => {
|
|
147
155
|
toDate = toDate !== "null" ? toDate : fromDate;
|
|
148
156
|
return { fromDate: fromDate, toDate: toDate };
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -15,15 +15,14 @@ export declare const calPercent: (nbr: number, percentage: number) => number;
|
|
|
15
15
|
export declare const displayDateRangeFr: (getFromDate?: any, getToDate?: any) => string;
|
|
16
16
|
export declare const getNbOfDaysBetweenTwoDates: (date1: Date, date2: Date) => number;
|
|
17
17
|
export declare const getRandomColor: (brightness: number) => string;
|
|
18
|
-
export declare const removeDuplicates: (tab: any[]) => any[];
|
|
19
18
|
/**
|
|
20
19
|
* remove duplicates from array by crietere (key)
|
|
21
20
|
* @param tobs
|
|
22
21
|
* @param key
|
|
23
22
|
* @returns
|
|
24
23
|
*/
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
24
|
+
export declare const removeDuplicateObjects: (array: any[], property?: string) => any[];
|
|
25
|
+
export declare const duplicateObjects: (array: any[], property: string) => any[];
|
|
27
26
|
export declare const toObjectDate: (fromDate: any, toDate: string) => {
|
|
28
27
|
fromDate: any;
|
|
29
28
|
toDate: string;
|
package/lib/esm/utils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
+
import lodash from "lodash";
|
|
2
3
|
require("dayjs/locale/fr");
|
|
3
4
|
export const formatDateYmdHypen = (date) => {
|
|
4
5
|
return formatDateYmd(date, "-");
|
|
@@ -92,29 +93,37 @@ export const getRandomColor = (brightness) => {
|
|
|
92
93
|
});
|
|
93
94
|
return "rgb(" + mixedrgb.join(",") + ")";
|
|
94
95
|
};
|
|
95
|
-
export const removeDuplicates = (tab) => {
|
|
96
|
-
|
|
97
|
-
};
|
|
96
|
+
/* export const removeDuplicates = (tab: any[]) => {
|
|
97
|
+
return tab.filter((v, i, a) => a.findIndex((t) => t.id === v.id && t.name === v.name) === i);
|
|
98
|
+
}; */
|
|
98
99
|
/**
|
|
99
100
|
* remove duplicates from array by crietere (key)
|
|
100
101
|
* @param tobs
|
|
101
102
|
* @param key
|
|
102
103
|
* @returns
|
|
103
104
|
*/
|
|
104
|
-
export const removeDuplicatesByKey = (tobs, property) => {
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
export const removeDuplicateObjects = (array, property) => {
|
|
108
|
-
|
|
105
|
+
/* export const removeDuplicatesByKey = (tobs: any[], property: string) => {
|
|
106
|
+
return [...new Map(tobs.map((item) => [item[property], item])).values()];
|
|
107
|
+
}; */
|
|
108
|
+
export const removeDuplicateObjects = (array, property = "id") => {
|
|
109
|
+
return array.filter((obj, index) => array.findIndex((item) => lodash.get(item, property) === lodash.get(obj, property)) === index);
|
|
110
|
+
/* const uniqueIds: any[] = [];
|
|
109
111
|
const unique = array.filter((element) => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return
|
|
112
|
+
const isDuplicate = uniqueIds.includes(element[property]);
|
|
113
|
+
|
|
114
|
+
if (!isDuplicate) {
|
|
115
|
+
uniqueIds.push(element[property]);
|
|
116
|
+
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return false;
|
|
116
121
|
});
|
|
117
|
-
|
|
122
|
+
|
|
123
|
+
return unique; */
|
|
124
|
+
};
|
|
125
|
+
export const duplicateObjects = (array, property) => {
|
|
126
|
+
return array.filter((obj, index) => array.findIndex((item) => lodash.get(item, property) === lodash.get(obj, property)) !== index);
|
|
118
127
|
};
|
|
119
128
|
export const toObjectDate = (fromDate, toDate) => {
|
|
120
129
|
toDate = toDate !== "null" ? toDate : fromDate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asv-hlps",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.11",
|
|
4
4
|
"description": "helpers",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -17,19 +17,21 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bcryptjs": "^2.4.2",
|
|
20
|
+
"@types/lodash": "^4.14.195",
|
|
20
21
|
"@types/pdfmake": "^0.2.2",
|
|
21
22
|
"@types/randomatic": "^3.1.3",
|
|
22
|
-
"@types/react": "^18.2.
|
|
23
|
-
"typescript": "^5.
|
|
23
|
+
"@types/react": "^18.2.15",
|
|
24
|
+
"typescript": "^5.1.6"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"axios": "^1.
|
|
27
|
+
"axios": "^1.4.0",
|
|
27
28
|
"bcryptjs": "^2.4.3",
|
|
28
29
|
"classnames": "^2.3.2",
|
|
29
|
-
"dayjs": "^1.11.
|
|
30
|
+
"dayjs": "^1.11.9",
|
|
30
31
|
"jwt-decode": "^3.1.2",
|
|
32
|
+
"lodash": "^4.17.21",
|
|
31
33
|
"pdfmake": "^0.2.7",
|
|
32
34
|
"randomatic": "^3.1.1",
|
|
33
|
-
"yup": "^1.
|
|
35
|
+
"yup": "^1.2.0"
|
|
34
36
|
}
|
|
35
37
|
}
|