asv-hlps 1.3.29 → 1.3.31
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/user.d.ts +3 -3
- package/lib/cjs/utils.d.ts +2 -0
- package/lib/cjs/utils.js +10 -2
- package/lib/esm/user.d.ts +3 -3
- package/lib/esm/utils.d.ts +2 -0
- package/lib/esm/utils.js +6 -0
- package/package.json +1 -1
package/lib/cjs/user.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ interface FullnameType {
|
|
|
12
12
|
titr?: UserTitr;
|
|
13
13
|
}
|
|
14
14
|
export declare const inGrp: <T extends {
|
|
15
|
-
grp
|
|
15
|
+
grp?: UserGrp;
|
|
16
16
|
}>(grps: string[], user: T) => boolean;
|
|
17
17
|
export declare const displaySteOrStaff: <T extends {
|
|
18
|
-
ste
|
|
18
|
+
ste?: Ste;
|
|
19
19
|
fullname: string;
|
|
20
20
|
}>(user: T, steNames?: string[]) => string;
|
|
21
21
|
export declare const inSteGrp: <T extends {
|
|
22
|
-
ste
|
|
22
|
+
ste?: Ste;
|
|
23
23
|
}>(grps: string[], user: T) => boolean;
|
|
24
24
|
export declare const hasRole: (roles: string[], userRole: UserRole) => boolean;
|
|
25
25
|
export declare const isBillPeriod: (user: User | UserNotarial, period: string) => boolean;
|
package/lib/cjs/utils.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export declare const findSequencesMissing: (arr: any[]) => number[];
|
|
|
35
35
|
export declare const fillNumWithZero: (num: number, targetLength: number) => string;
|
|
36
36
|
export declare const findFirstSequenceMissing: (arr: any[]) => number;
|
|
37
37
|
export declare const deepClone: (obj: any) => any;
|
|
38
|
+
export declare const diffArraysByFunc: (arr1: any[], arr2: any[], func: any) => any[];
|
|
39
|
+
export declare const diffArraysByProp: (arr1: any[], arr2: any[], propArr1?: string, propArr2?: string) => any[];
|
|
38
40
|
export declare const removeString: (text: string, word: string) => string;
|
|
39
41
|
export declare const removeBackSlashOccurences: (text: string, toChar: string) => string;
|
|
40
42
|
export declare const genSequenceRef: (refs: any[], startChars: string, zeroFillWidth: number, dateFormat?: string) => string;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -3,8 +3,8 @@ 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.
|
|
7
|
-
exports.toggleProp = exports.roundLastNDigits = 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 = void 0;
|
|
6
|
+
exports.insertAtInArray = exports.isBirthday = exports.padEndWithZero = exports.padStartWithZero = exports.formatMonthYearToLocaleString = exports.calculPercent = exports.validEmail = exports.convertToCfa = exports.packAndUnit = 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.diffArraysByProp = exports.diffArraysByFunc = 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 = void 0;
|
|
7
|
+
exports.toggleProp = exports.roundLastNDigits = 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 = void 0;
|
|
8
8
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
9
9
|
const relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
|
|
10
10
|
const lodash_1 = __importDefault(require("lodash"));
|
|
@@ -243,6 +243,14 @@ const deepClone = (obj) => {
|
|
|
243
243
|
return lodash_1.default.cloneDeep(obj);
|
|
244
244
|
};
|
|
245
245
|
exports.deepClone = deepClone;
|
|
246
|
+
const diffArraysByFunc = (arr1, arr2, func) => {
|
|
247
|
+
return lodash_1.default.differenceBy(arr1, arr2, func);
|
|
248
|
+
};
|
|
249
|
+
exports.diffArraysByFunc = diffArraysByFunc;
|
|
250
|
+
const diffArraysByProp = (arr1, arr2, propArr1 = "id", propArr2 = "id") => {
|
|
251
|
+
return lodash_1.default.differenceWith(arr1, arr2, (a, b) => lodash_1.default.isEqual(a[propArr1], b[propArr2]));
|
|
252
|
+
};
|
|
253
|
+
exports.diffArraysByProp = diffArraysByProp;
|
|
246
254
|
const removeString = (text, word) => {
|
|
247
255
|
return text.toLowerCase().replace(word.toLowerCase(), "") || text;
|
|
248
256
|
};
|
package/lib/esm/user.d.ts
CHANGED
|
@@ -12,14 +12,14 @@ interface FullnameType {
|
|
|
12
12
|
titr?: UserTitr;
|
|
13
13
|
}
|
|
14
14
|
export declare const inGrp: <T extends {
|
|
15
|
-
grp
|
|
15
|
+
grp?: UserGrp;
|
|
16
16
|
}>(grps: string[], user: T) => boolean;
|
|
17
17
|
export declare const displaySteOrStaff: <T extends {
|
|
18
|
-
ste
|
|
18
|
+
ste?: Ste;
|
|
19
19
|
fullname: string;
|
|
20
20
|
}>(user: T, steNames?: string[]) => string;
|
|
21
21
|
export declare const inSteGrp: <T extends {
|
|
22
|
-
ste
|
|
22
|
+
ste?: Ste;
|
|
23
23
|
}>(grps: string[], user: T) => boolean;
|
|
24
24
|
export declare const hasRole: (roles: string[], userRole: UserRole) => boolean;
|
|
25
25
|
export declare const isBillPeriod: (user: User | UserNotarial, period: string) => boolean;
|
package/lib/esm/utils.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export declare const findSequencesMissing: (arr: any[]) => number[];
|
|
|
35
35
|
export declare const fillNumWithZero: (num: number, targetLength: number) => string;
|
|
36
36
|
export declare const findFirstSequenceMissing: (arr: any[]) => number;
|
|
37
37
|
export declare const deepClone: (obj: any) => any;
|
|
38
|
+
export declare const diffArraysByFunc: (arr1: any[], arr2: any[], func: any) => any[];
|
|
39
|
+
export declare const diffArraysByProp: (arr1: any[], arr2: any[], propArr1?: string, propArr2?: string) => any[];
|
|
38
40
|
export declare const removeString: (text: string, word: string) => string;
|
|
39
41
|
export declare const removeBackSlashOccurences: (text: string, toChar: string) => string;
|
|
40
42
|
export declare const genSequenceRef: (refs: any[], startChars: string, zeroFillWidth: number, dateFormat?: string) => string;
|
package/lib/esm/utils.js
CHANGED
|
@@ -212,6 +212,12 @@ export const deepClone = (obj) => {
|
|
|
212
212
|
// return JSON.parse(JSON.stringify(obj));
|
|
213
213
|
return lodash.cloneDeep(obj);
|
|
214
214
|
};
|
|
215
|
+
export const diffArraysByFunc = (arr1, arr2, func) => {
|
|
216
|
+
return lodash.differenceBy(arr1, arr2, func);
|
|
217
|
+
};
|
|
218
|
+
export const diffArraysByProp = (arr1, arr2, propArr1 = "id", propArr2 = "id") => {
|
|
219
|
+
return lodash.differenceWith(arr1, arr2, (a, b) => lodash.isEqual(a[propArr1], b[propArr2]));
|
|
220
|
+
};
|
|
215
221
|
export const removeString = (text, word) => {
|
|
216
222
|
return text.toLowerCase().replace(word.toLowerCase(), "") || text;
|
|
217
223
|
};
|