Parcourir la source

Auto commit for build : 23

 commit by: a.hassani <hassani.ayoub@gmail.com>

 with message : 0.0.2 In npmjs starting the 0.0.3
ayoub il y a 2 ans
Parent
commit
a705b6c975
4 fichiers modifiés avec 190 ajouts et 1 suppressions
  1. 52 1
      README.md
  2. 54 0
      index.d.ts
  3. 49 0
      index.js
  4. 35 0
      package.json

+ 52 - 1
README.md

@@ -1,2 +1,53 @@
-# rex
+## what is `@d3v4pp/rex`
 
+`d3v4pp/rex` is an [npm package](https://www.npmjs.com/package/@d3v4pp/rex) that contains a set of regular expressions, and that's it.
+
+## installation & Usage
+
+#### Current version
+
+```
+npm i @d3v4pp/rex --save
+```
+
+#### Next version
+
+```
+npm i git+http://cvs.hassani-lab.fr/ayoub/Rex.git --save
+```
+
+#### How to use
+
+```javascript
+const { email, alpha, num } = require("@d3v4pp/rex");
+
+email.test("email@example.com") //will return true
+alpha.test("2233er") //will return false
+num.test("1234") //will return true
+
+```
+
+## Included Regular expressions
+
+|    Regex    |                             Description                              |
+| :---------: | :------------------------------------------------------------------: |
+|     num     |                             numeric only                             |
+|    alpha    |                only chars no numbers no special chars                |
+|  alphanum   |                      chars alphabet and numbers                      |
+|    email    |                            a valid email                             |
+|     url     |                             a valid url                              |
+|  ipAddress  |                              ip addr v4                              |
+|  password   | complex password with special char, numeric uppercase and lowwercase |
+|    phone    |                         french phone number                          |
+|  codePost   |                           french zip code                            |
+|    time     |                            time hh:mm:ss                             |
+|    price    |                    float with a precision of two                     |
+|    date     |                        french date dd/mm/YYYY                        |
+|     tva     |               french TVA, Set of values 5.5, 10 and 20               |
+|    prix     |                    float with a precision of two                     |
+|    date     |                          Fr date jj/mm/yyyy                          |
+|  password   |                           complex password                           |
+| motDePasse  |                           complex password                           |
+|  matricule  |                       european immatriculation                       |
+| tvaIntercom |                    French TVA intra communautaire                    |
+|    iban     |                             french IBAN                              |

+ 54 - 0
index.d.ts

@@ -0,0 +1,54 @@
+declare const  alphabetique: RegExp;
+declare const email: RegExp;
+declare const alpha: RegExp;
+declare const num: RegExp;
+declare const alphanum: RegExp;
+declare const url: RegExp;
+declare const ipAddress: RegExp;
+declare const phone: RegExp;
+declare const codePost: RegExp;
+declare const time: RegExp;
+declare const date: RegExp;
+declare const tva: RegExp;
+declare const price: RegExp;
+
+
+declare const numMask: RegExp;
+declare const alphaMask: RegExp;
+declare const alphanumMask: RegExp;
+declare const emailMask: RegExp;
+declare const urlMask: RegExp;
+declare const ipAddressMask: RegExp;
+declare const prix: RegExp;
+declare const password: RegExp;
+declare const motDePasse: RegExp;
+declare const matricule: RegExp;
+declare const tvaIntercom: RegExp;
+declare const iban: RegExp;
+export {
+    // regexs
+    email,
+    alpha,
+    num,
+    alphanum,
+    url,
+    ipAddress,
+    date,
+    time,
+    tva,
+    price,
+    prix,
+    alphabetique,
+    password,
+    motDePasse,
+    matricule,
+    tvaIntercom,
+    iban,
+    //masks 
+    numMask,
+    alphaMask,
+    alphanumMask,
+    emailMask,
+    urlMask,
+    ipAddressMask
+}

+ 49 - 0
index.js

@@ -0,0 +1,49 @@
+module.exports = {
+
+
+    "num": /^[0-9]+$/,
+    "numeric": /^[0-9]+$/,
+    "alpha": /^[a-zA-Z_]+$/,
+    "alphabetic": /^[a-zA-Z_]+$/,
+    "alphabetique":/^[A-Za-z\s\u00C0-\u00FF]+$/,
+    "alphanum": /^[a-zA-Z0-9_]+$/,
+    "alphanumeric": /^[a-zA-Z0-9_]+$/,
+    "email": /^(")?(?:[^\."\s])(?:(?:[\.])?(?:[\w\-!#$%&'*+/=?^_`{|}~]))*\1@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/,
+    "url": /(((^https?)|(^ftp)):\/\/((([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*)|(localhost|LOCALHOST))\/?)/i,
+    "ipAddress": /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,
+    "phone": /^(?:(?:\+|00)33|0)\s*[1-9](?:\d{2}){4}$/,
+    "codePost": /^(((?!(96|97|98|99|00)))[0-9]{5})$|(2A|2B|2a|2b)[0-9]{3}$|(971|972|973|974|975|976)[0-9]{2}$/,
+    "codePostal": /^(((?!(96|97|98|99|00)))[0-9]{5})$|(2A|2B|2a|2b)[0-9]{3}$|(971|972|973|974|975|976)[0-9]{2}$/,
+    "time": /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/,
+    "price": /^\d+(\.\d{2})?$/,
+    "prix": /^\d+(\.\d{2})?$/,
+    "date": /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/,
+    "tva": /^(5\.5|10|20)$/,
+    "password": /(?=^.{8,}$)(?=.*\d)(?=.*[!@#$%^&*]+)(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
+    "motDePasse": /(?=^.{8,}$)(?=.*\d)(?=.*[!@#$%^&*]+)(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
+    "matricule": /[A-HJ-NP-TV-Z]{2}[\s-]{0,1}[0-9]{3}[\s-]{0,1}[A-HJ-NP-TV-Z]{2}|[0-9]{2,4}[\s-]{0,1}[A-Z]{1,3}[\s-]{0,1}[0-9]{2}/,
+    // "matricule": /(^\d{1,4}[A-Za-z]{1,4}\d{1,2}$)|(^[A-Za-z]{1,2}\s*\d{1,3}\s*[A-Za-z]{1,2})|(^\d{1,4}-[A-Za-z]{1,4}-\d{1,2}$)|(^[A-Za-z]{1,2}-\s*\d{1,3}-\s*[A-Za-z]{1,2})$/,
+    "tvaIntercom": /^(FR)([0-9]{11}$)/,
+    "iban": /^FR\d{12}[A-Z0-9]{11}\d{2}$/,
+
+
+
+
+
+
+
+
+
+    "timeMask": /[\d\s:amp]/i,
+    'numMask': /[0-9]/i,
+    'alphaMask': /[a-z_]/i,
+    'alphanumMask': /[a-z0-9_]/i,
+    'emailMask': /[\w.\-@'"!#$%&'*+/=?^_`{|}~]/i,
+    'urlMask': /[a-z0-9_]/i,
+    'ipAddressMask': /[\d\.]/i,
+    "phoneMask": /[0-9\+]/i,
+    "codePostMask": /[0-9ABab]/i,
+    'passwordMask': /[\w.\-@'"!#$%&'*+/=?^_`{|}~]/i,
+
+
+}

+ 35 - 0
package.json

@@ -0,0 +1,35 @@
+{
+  "name": "@d3v4pp/rex",
+  "version": "0.0.3",
+  "description": "a set of usefull regEx By D3v4pp",
+  "main": "index.js",
+  "scripts": {
+    "test":"mocha tests"
+  },
+  "files": [
+    "index.d.ts",
+    "index.js",
+    "package.json",
+    "README.md"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "https://cvs.d3v4pp.fr/D3V4PP/Rex.git"
+  },
+  "author": {
+    "name" : "Ayoub Hassani <D3v4pp>",
+    "email" : "ayoub@d3v4pp.fr",
+    "url" : "https://d3v4pp.fr/"
+  },
+  "funding": "https://paypal.me/SupportTheDoc",
+  "homepage": "https://cvs.d3v4pp.fr/D3V4PP/Rex/src/master/README.md",
+  "bugs": {
+    "url" : "https://cvs.d3v4pp.fr/D3V4PP/Rex/issues",
+    "email" : "ayoub@d3v4pp.fr"
+  },
+  "keywords": ["regex","validation"],
+  "license": "ISC",
+  "devDependencies": {
+    "mocha": "^9.0.1"
+  }
+}