@cofondateurauchomage/libs 1.0.0 → 1.0.1

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/const.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const SKILLS: string[];
package/lib/const.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SKILLS = void 0;
4
+ exports.SKILLS = ['Business', 'Design', 'Marketing', 'Produit', 'Tech'];
@@ -0,0 +1,18 @@
1
+ export declare enum Collections {
2
+ users = "users"
3
+ }
4
+ export interface IUser {
5
+ lastName: string;
6
+ firstName: string;
7
+ email: string;
8
+ joblessDate: string;
9
+ zipCode: number;
10
+ city: string;
11
+ linkedin: string;
12
+ tel?: string;
13
+ skills: string[];
14
+ motivations: string;
15
+ partner: string;
16
+ business: string;
17
+ invest?: number;
18
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Collections = void 0;
4
+ var Collections;
5
+ (function (Collections) {
6
+ Collections["users"] = "users";
7
+ })(Collections = exports.Collections || (exports.Collections = {}));
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { SKILLS } from "./const";
2
+ export { Collections, IUser } from "./db.model";
3
+ export { checkSkills } from "./utils/checkSkills";
4
+ export { RGX } from "./utils/regex";
package/lib/index.js ADDED
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RGX = exports.checkSkills = exports.Collections = exports.SKILLS = void 0;
4
+ var const_1 = require("./const");
5
+ Object.defineProperty(exports, "SKILLS", { enumerable: true, get: function () { return const_1.SKILLS; } });
6
+ var db_model_1 = require("./db.model");
7
+ Object.defineProperty(exports, "Collections", { enumerable: true, get: function () { return db_model_1.Collections; } });
8
+ var checkSkills_1 = require("./utils/checkSkills");
9
+ Object.defineProperty(exports, "checkSkills", { enumerable: true, get: function () { return checkSkills_1.checkSkills; } });
10
+ var regex_1 = require("./utils/regex");
11
+ Object.defineProperty(exports, "RGX", { enumerable: true, get: function () { return regex_1.RGX; } });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if at least one skill is checked
3
+ * @param skills
4
+ * @returns
5
+ */
6
+ export declare function checkSkills(skills: string[]): boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkSkills = void 0;
4
+ const const_1 = require("../const");
5
+ /**
6
+ * Checks if at least one skill is checked
7
+ * @param skills
8
+ * @returns
9
+ */
10
+ function checkSkills(skills) {
11
+ let check = true;
12
+ skills.forEach((skill) => {
13
+ if (!const_1.SKILLS.includes(skill))
14
+ check = false;
15
+ });
16
+ return check;
17
+ }
18
+ exports.checkSkills = checkSkills;
@@ -0,0 +1,37 @@
1
+ export declare const RGX: {
2
+ Email: {
3
+ regex: RegExp;
4
+ };
5
+ Name: {
6
+ regex: RegExp;
7
+ pattern: string;
8
+ message: string;
9
+ };
10
+ Date: {
11
+ regex: RegExp;
12
+ };
13
+ City: {
14
+ regex: RegExp;
15
+ pattern: string;
16
+ message: string;
17
+ };
18
+ Tel: {
19
+ regex: RegExp;
20
+ pattern: string;
21
+ message: string;
22
+ };
23
+ Linkedin: {
24
+ regex: RegExp;
25
+ pattern: string;
26
+ message: string;
27
+ };
28
+ Pwd: {
29
+ regex: RegExp;
30
+ pattern: string;
31
+ message: string;
32
+ };
33
+ Text: {
34
+ regex: RegExp;
35
+ message: string;
36
+ };
37
+ };
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RGX = void 0;
4
+ exports.RGX = {
5
+ Email: {
6
+ regex: /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/,
7
+ },
8
+ Name: {
9
+ regex: /^[A-Za-zÜ-ü]{1,24}([ -]{1}[A-Za-zÜ-ü]{1,24})?$/,
10
+ pattern: '[A-Za-zÜ-ü]{1,24}([ -]{1}[A-Za-zÜ-ü]{1,24})?',
11
+ message: 'Accepte les noms composés (espace ou -) et les accents. Les caractères spéciaux ne sont pas autorisés.',
12
+ },
13
+ Date: {
14
+ regex: /^([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))$/,
15
+ },
16
+ City: {
17
+ regex: /^(?=(.*[A-Za-z]){1,45})[A-Za-z]{1,20}([ -]{1}[A-Za-z]{1,24}){0,8}$/,
18
+ pattern: '(?=(.*[A-Za-z]){1,45})[A-Za-z]{1,20}([ -]{1}[A-Za-z]{1,24}){0,8}',
19
+ message: 'Veuillez entrer un nom de ville valide.'
20
+ },
21
+ Tel: {
22
+ regex: /^([+]{1}[1-9]{2,3}[ .-]?)?[0-9]{1,3}([ .-]?[0-9]{2,3}){3,6}$/,
23
+ pattern: '([+]{1}[1-9]{2,3}[ .-]?)?[0-9]{1,3}([ .-]?[0-9]{2,3}){3,6}',
24
+ message: 'Veuillez entrer un numéro de téléphone valide.',
25
+ },
26
+ Linkedin: {
27
+ regex: /^(http(s)?:\/\/)?([\w]+\.)?linkedin\.com\/(pub|in|profile)\/.+$/,
28
+ pattern: `(http(s)?:\/\/)?([\w]+\.)?linkedin\.com\/(pub|in|profile)\/.+`,
29
+ message: `Le lien doit être un URL LinkedIn valide. (ex: https://www.linkedin.com/in/valentin-lemaire/)`,
30
+ },
31
+ Pwd: {
32
+ regex: /^(?=.*[0-9])(?=.*[A-z])([^\s]){8,24}$/,
33
+ pattern: `(?=.*[0-9])(?=.*[A-z])([^\\s]){8,24}`,
34
+ message: 'Votre mot de passe doit contenir entre 8 et 24 caractères dont 1 chiffre et 1 lettre.',
35
+ },
36
+ Text: {
37
+ regex: /^(?=(.*[A-Za-z]){10}).{10,300}$/,
38
+ message: 'Le texte doit contenir au moins 10 lettres et ne pas excéder 300 caractères.'
39
+ }
40
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "main": "lib/index",
6
6
  "scripts": {