asv-hlps 1.3.7 → 1.3.9
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 +2 -2
- package/lib/cjs/user.js +4 -4
- package/lib/cjs/utils.js +2 -2
- package/lib/esm/user.d.ts +2 -2
- package/lib/esm/user.js +4 -4
- package/lib/esm/utils.js +2 -2
- package/package.json +1 -1
package/lib/cjs/user.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ interface FullnameType {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const inGrp: (grps: string[], user: User | UserNotarial) => boolean;
|
|
14
14
|
export declare const inSteGrp: (grps: string[], user: User | UserNotarial) => boolean;
|
|
15
|
-
export declare const hasRole: (roles: string[],
|
|
15
|
+
export declare const hasRole: (roles: string[], userRole: UserRole) => boolean;
|
|
16
16
|
export declare const isBillPeriod: (user: User | UserNotarial, period: string) => boolean;
|
|
17
|
-
export declare const isStaffSte: (steNames: string[],
|
|
17
|
+
export declare const isStaffSte: (steNames: string[], userSteName: string) => boolean;
|
|
18
18
|
export declare const getFullname: <T extends FullnameType>(user: T) => string;
|
|
19
19
|
export declare const entryDesignationUser: (user: User | UserNotarial) => string;
|
|
20
20
|
export declare const secureUser: (user: any, username: string, heads: any) => void;
|
package/lib/cjs/user.js
CHANGED
|
@@ -44,8 +44,8 @@ exports.inSteGrp = inSteGrp;
|
|
|
44
44
|
/* export const hasRole = (roles: string[], user: User | UserNotarial) => {
|
|
45
45
|
return [...roles].includes(user.role.code.toLowerCase()) ? true : false;
|
|
46
46
|
}; */
|
|
47
|
-
const hasRole = (roles,
|
|
48
|
-
return [...roles].includes(
|
|
47
|
+
const hasRole = (roles, userRole) => {
|
|
48
|
+
return [...roles].includes(userRole.code.toLowerCase()) ? true : false;
|
|
49
49
|
};
|
|
50
50
|
exports.hasRole = hasRole;
|
|
51
51
|
const isBillPeriod = (user, period) => {
|
|
@@ -56,8 +56,8 @@ exports.isBillPeriod = isBillPeriod;
|
|
|
56
56
|
|
|
57
57
|
return [...steNames].includes(user.ste.name.toLowerCase());
|
|
58
58
|
}; */
|
|
59
|
-
const isStaffSte = (steNames,
|
|
60
|
-
return [...steNames].includes(
|
|
59
|
+
const isStaffSte = (steNames, userSteName) => {
|
|
60
|
+
return [...steNames].includes(userSteName.toLowerCase());
|
|
61
61
|
};
|
|
62
62
|
exports.isStaffSte = isStaffSte;
|
|
63
63
|
// export const getFullname = (user: User | UserNotarial) => {
|
package/lib/cjs/utils.js
CHANGED
|
@@ -618,7 +618,7 @@ exports.monthStringName = monthStringName;
|
|
|
618
618
|
const dateFormatter = (date, format, separator = "-") => {
|
|
619
619
|
switch (format) {
|
|
620
620
|
case "ymd":
|
|
621
|
-
return (0, dayjs_1.default)(date).format(`
|
|
621
|
+
return (0, dayjs_1.default)(date).format(`YYYY${separator}MM${separator}DD`);
|
|
622
622
|
case "dmy":
|
|
623
623
|
return (0, dayjs_1.default)(date).format(`DD${separator}MM${separator}YYYY`);
|
|
624
624
|
case "dmy-hm":
|
|
@@ -626,7 +626,7 @@ const dateFormatter = (date, format, separator = "-") => {
|
|
|
626
626
|
case "dmyfr":
|
|
627
627
|
return (0, dayjs_1.default)(date).locale("fr").format("dddd DD MMMM YYYY");
|
|
628
628
|
default:
|
|
629
|
-
return (0, dayjs_1.default)(date).format(`
|
|
629
|
+
return (0, dayjs_1.default)(date).format(`YYYY${separator}MM${separator}DD`);
|
|
630
630
|
}
|
|
631
631
|
};
|
|
632
632
|
exports.dateFormatter = dateFormatter;
|
package/lib/esm/user.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ interface FullnameType {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const inGrp: (grps: string[], user: User | UserNotarial) => boolean;
|
|
14
14
|
export declare const inSteGrp: (grps: string[], user: User | UserNotarial) => boolean;
|
|
15
|
-
export declare const hasRole: (roles: string[],
|
|
15
|
+
export declare const hasRole: (roles: string[], userRole: UserRole) => boolean;
|
|
16
16
|
export declare const isBillPeriod: (user: User | UserNotarial, period: string) => boolean;
|
|
17
|
-
export declare const isStaffSte: (steNames: string[],
|
|
17
|
+
export declare const isStaffSte: (steNames: string[], userSteName: string) => boolean;
|
|
18
18
|
export declare const getFullname: <T extends FullnameType>(user: T) => string;
|
|
19
19
|
export declare const entryDesignationUser: (user: User | UserNotarial) => string;
|
|
20
20
|
export declare const secureUser: (user: any, username: string, heads: any) => void;
|
package/lib/esm/user.js
CHANGED
|
@@ -13,8 +13,8 @@ export const inSteGrp = (grps, user) => {
|
|
|
13
13
|
/* export const hasRole = (roles: string[], user: User | UserNotarial) => {
|
|
14
14
|
return [...roles].includes(user.role.code.toLowerCase()) ? true : false;
|
|
15
15
|
}; */
|
|
16
|
-
export const hasRole = (roles,
|
|
17
|
-
return [...roles].includes(
|
|
16
|
+
export const hasRole = (roles, userRole) => {
|
|
17
|
+
return [...roles].includes(userRole.code.toLowerCase()) ? true : false;
|
|
18
18
|
};
|
|
19
19
|
export const isBillPeriod = (user, period) => {
|
|
20
20
|
return user.periodBill.toLowerCase() === period ? true : false;
|
|
@@ -23,8 +23,8 @@ export const isBillPeriod = (user, period) => {
|
|
|
23
23
|
|
|
24
24
|
return [...steNames].includes(user.ste.name.toLowerCase());
|
|
25
25
|
}; */
|
|
26
|
-
export const isStaffSte = (steNames,
|
|
27
|
-
return [...steNames].includes(
|
|
26
|
+
export const isStaffSte = (steNames, userSteName) => {
|
|
27
|
+
return [...steNames].includes(userSteName.toLowerCase());
|
|
28
28
|
};
|
|
29
29
|
// export const getFullname = (user: User | UserNotarial) => {
|
|
30
30
|
export const getFullname = (user) => {
|
package/lib/esm/utils.js
CHANGED
|
@@ -536,7 +536,7 @@ export const monthStringName = (date, format = "MMM", options) => {
|
|
|
536
536
|
export const dateFormatter = (date, format, separator = "-") => {
|
|
537
537
|
switch (format) {
|
|
538
538
|
case "ymd":
|
|
539
|
-
return dayjs(date).format(`
|
|
539
|
+
return dayjs(date).format(`YYYY${separator}MM${separator}DD`);
|
|
540
540
|
case "dmy":
|
|
541
541
|
return dayjs(date).format(`DD${separator}MM${separator}YYYY`);
|
|
542
542
|
case "dmy-hm":
|
|
@@ -544,6 +544,6 @@ export const dateFormatter = (date, format, separator = "-") => {
|
|
|
544
544
|
case "dmyfr":
|
|
545
545
|
return dayjs(date).locale("fr").format("dddd DD MMMM YYYY");
|
|
546
546
|
default:
|
|
547
|
-
return dayjs(date).format(`
|
|
547
|
+
return dayjs(date).format(`YYYY${separator}MM${separator}DD`);
|
|
548
548
|
}
|
|
549
549
|
};
|