asv-hlps 1.0.8 → 1.0.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/users/user.d.ts +1 -1
- package/lib/cjs/users/user.js +5 -4
- package/lib/cjs/utils/shared.d.ts +2 -2
- package/lib/cjs/utils/shared.js +2 -2
- package/lib/esm/users/user.d.ts +1 -1
- package/lib/esm/users/user.js +5 -4
- package/lib/esm/utils/shared.d.ts +2 -2
- package/lib/esm/utils/shared.js +2 -2
- package/package.json +1 -1
package/lib/cjs/users/user.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const inGrp: (grps: string[], user: User) => boolean;
|
|
|
3
3
|
export declare const inSteGrp: (grps: string[], user: User) => boolean;
|
|
4
4
|
export declare const hasRole: (roles: string[], user: User) => boolean;
|
|
5
5
|
export declare const isBillPeriod: (user: User, period: string) => boolean;
|
|
6
|
-
export declare const isStaffSte: (user: User, steNames: string
|
|
6
|
+
export declare const isStaffSte: (user: User, steNames: string[]) => boolean;
|
|
7
7
|
export declare const getFullname: (user: User) => string;
|
|
8
8
|
export declare const entryDesignationUser: (user: User) => string;
|
|
9
9
|
export declare const secureUser: (user: any, username: string, heads: any) => void;
|
package/lib/cjs/users/user.js
CHANGED
|
@@ -27,9 +27,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.getUserCode = exports.secureUserPassword = exports.secureUser = exports.entryDesignationUser = exports.getFullname = exports.isStaffSte = exports.isBillPeriod = exports.hasRole = exports.inSteGrp = exports.inGrp = void 0;
|
|
30
|
-
const shared_1 = require("../utils/shared");
|
|
31
30
|
const bcrypt = __importStar(require("bcryptjs"));
|
|
32
31
|
const randomatic_1 = __importDefault(require("randomatic"));
|
|
32
|
+
const shared_1 = require("../utils/shared");
|
|
33
33
|
const inGrp = (grps, user) => {
|
|
34
34
|
return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
|
|
35
35
|
};
|
|
@@ -52,10 +52,11 @@ const isBillPeriod = (user, period) => {
|
|
|
52
52
|
return (user.periodBill.toLowerCase() === period) ? true : false;
|
|
53
53
|
};
|
|
54
54
|
exports.isBillPeriod = isBillPeriod;
|
|
55
|
+
// export const isStaffSte = (user: User, steNames: string|string[]) => {
|
|
55
56
|
const isStaffSte = (user, steNames) => {
|
|
56
|
-
if
|
|
57
|
-
|
|
58
|
-
}
|
|
57
|
+
/* if(!Array.isArray(steNames)) {
|
|
58
|
+
return (user.ste.name.toLowerCase() === steNames.toLowerCase());
|
|
59
|
+
} */
|
|
59
60
|
// return [...steNames].includes(user.ste.name.toLowerCase()) ? true : false;
|
|
60
61
|
return [...steNames].includes(user.ste.name.toLowerCase());
|
|
61
62
|
};
|
|
@@ -57,5 +57,5 @@ export declare const packAndUnit: (qtity: number, qtityPerPackaging?: number) =>
|
|
|
57
57
|
export declare const convertToCfa: (price: number, currency?: string, dollarRate?: number) => number;
|
|
58
58
|
export declare const validEmail: (email: string) => boolean;
|
|
59
59
|
export declare const calculPercent: (nbr: number, percentage: number) => number;
|
|
60
|
-
export declare const padStartWithZero: (num:
|
|
61
|
-
export declare const padEndWithZero: (num:
|
|
60
|
+
export declare const padStartWithZero: (num: any, targetLength: number) => any;
|
|
61
|
+
export declare const padEndWithZero: (num: any, targetLength: number) => any;
|
package/lib/cjs/utils/shared.js
CHANGED
|
@@ -369,10 +369,10 @@ const calculPercent = (nbr, percentage) => {
|
|
|
369
369
|
};
|
|
370
370
|
exports.calculPercent = calculPercent;
|
|
371
371
|
const padStartWithZero = (num, targetLength) => {
|
|
372
|
-
return num.toString().padStart(targetLength,
|
|
372
|
+
return num.toString().padStart(targetLength, 0);
|
|
373
373
|
};
|
|
374
374
|
exports.padStartWithZero = padStartWithZero;
|
|
375
375
|
const padEndWithZero = (num, targetLength) => {
|
|
376
|
-
return num.toString().padEnd(targetLength,
|
|
376
|
+
return num.toString().padEnd(targetLength, 0);
|
|
377
377
|
};
|
|
378
378
|
exports.padEndWithZero = padEndWithZero;
|
package/lib/esm/users/user.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const inGrp: (grps: string[], user: User) => boolean;
|
|
|
3
3
|
export declare const inSteGrp: (grps: string[], user: User) => boolean;
|
|
4
4
|
export declare const hasRole: (roles: string[], user: User) => boolean;
|
|
5
5
|
export declare const isBillPeriod: (user: User, period: string) => boolean;
|
|
6
|
-
export declare const isStaffSte: (user: User, steNames: string
|
|
6
|
+
export declare const isStaffSte: (user: User, steNames: string[]) => boolean;
|
|
7
7
|
export declare const getFullname: (user: User) => string;
|
|
8
8
|
export declare const entryDesignationUser: (user: User) => string;
|
|
9
9
|
export declare const secureUser: (user: any, username: string, heads: any) => void;
|
package/lib/esm/users/user.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { titleCase } from "../utils/shared";
|
|
2
1
|
import * as bcrypt from 'bcryptjs';
|
|
3
2
|
import randomatic from 'randomatic';
|
|
3
|
+
import { titleCase } from "../utils/shared";
|
|
4
4
|
export const inGrp = (grps, user) => {
|
|
5
5
|
return [...grps].includes(user.grp.code.toLowerCase()) ? true : false;
|
|
6
6
|
};
|
|
@@ -19,10 +19,11 @@ export const hasRole = (roles, user) => {
|
|
|
19
19
|
export const isBillPeriod = (user, period) => {
|
|
20
20
|
return (user.periodBill.toLowerCase() === period) ? true : false;
|
|
21
21
|
};
|
|
22
|
+
// export const isStaffSte = (user: User, steNames: string|string[]) => {
|
|
22
23
|
export const isStaffSte = (user, steNames) => {
|
|
23
|
-
if
|
|
24
|
-
|
|
25
|
-
}
|
|
24
|
+
/* if(!Array.isArray(steNames)) {
|
|
25
|
+
return (user.ste.name.toLowerCase() === steNames.toLowerCase());
|
|
26
|
+
} */
|
|
26
27
|
// return [...steNames].includes(user.ste.name.toLowerCase()) ? true : false;
|
|
27
28
|
return [...steNames].includes(user.ste.name.toLowerCase());
|
|
28
29
|
};
|
|
@@ -57,5 +57,5 @@ export declare const packAndUnit: (qtity: number, qtityPerPackaging?: number) =>
|
|
|
57
57
|
export declare const convertToCfa: (price: number, currency?: string, dollarRate?: number) => number;
|
|
58
58
|
export declare const validEmail: (email: string) => boolean;
|
|
59
59
|
export declare const calculPercent: (nbr: number, percentage: number) => number;
|
|
60
|
-
export declare const padStartWithZero: (num:
|
|
61
|
-
export declare const padEndWithZero: (num:
|
|
60
|
+
export declare const padStartWithZero: (num: any, targetLength: number) => any;
|
|
61
|
+
export declare const padEndWithZero: (num: any, targetLength: number) => any;
|
package/lib/esm/utils/shared.js
CHANGED
|
@@ -315,8 +315,8 @@ export const calculPercent = (nbr, percentage) => {
|
|
|
315
315
|
return nbr * percentage / 100;
|
|
316
316
|
};
|
|
317
317
|
export const padStartWithZero = (num, targetLength) => {
|
|
318
|
-
return num.toString().padStart(targetLength,
|
|
318
|
+
return num.toString().padStart(targetLength, 0);
|
|
319
319
|
};
|
|
320
320
|
export const padEndWithZero = (num, targetLength) => {
|
|
321
|
-
return num.toString().padEnd(targetLength,
|
|
321
|
+
return num.toString().padEnd(targetLength, 0);
|
|
322
322
|
};
|