lesca-validate 0.0.3 → 0.0.4
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/index.js +6 -12
- package/package.json +19 -16
package/lib/index.js
CHANGED
|
@@ -5,27 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ValidateYoutubeURL = exports.ValidateURL = exports.ValidatePhone = exports.ValidateEmail = exports.ValiDateInvoice = void 0;
|
|
7
7
|
var _misc = require("./misc");
|
|
8
|
-
var ValidateEmail = function ValidateEmail(email) {
|
|
8
|
+
var ValidateEmail = exports.ValidateEmail = function ValidateEmail(email) {
|
|
9
9
|
return String(email).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/) !== null;
|
|
10
10
|
};
|
|
11
|
-
exports.
|
|
12
|
-
var ValidatePhone = function ValidatePhone(phone) {
|
|
11
|
+
var ValidatePhone = exports.ValidatePhone = function ValidatePhone(phone) {
|
|
13
12
|
return phone !== '' && phone.length === 10 && phone.slice(0, 2) === '09';
|
|
14
13
|
};
|
|
15
|
-
exports.
|
|
16
|
-
var ValidateURL = function ValidateURL(str) {
|
|
14
|
+
var ValidateURL = exports.ValidateURL = function ValidateURL(str) {
|
|
17
15
|
var pattern = new RegExp('^(https?:\\/\\/)?' + '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + '((\\d{1,3}\\.){3}\\d{1,3}))' + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + '(\\?[;&a-z\\d%_.~+=-]*)?' + '(\\#[-a-z\\d_]*)?$', 'i');
|
|
18
16
|
return !!pattern.test(str);
|
|
19
17
|
};
|
|
20
|
-
exports.
|
|
21
|
-
var ValidateYoutubeURL = function ValidateYoutubeURL(url) {
|
|
18
|
+
var ValidateYoutubeURL = exports.ValidateYoutubeURL = function ValidateYoutubeURL(url) {
|
|
22
19
|
var pattern = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/;
|
|
23
20
|
var result = url.match(pattern);
|
|
24
21
|
if (result) return result[1];
|
|
25
22
|
return false;
|
|
26
23
|
};
|
|
27
|
-
exports.
|
|
28
|
-
var ValiDateInvoice = function ValiDateInvoice(value) {
|
|
24
|
+
var ValiDateInvoice = exports.ValiDateInvoice = function ValiDateInvoice(value) {
|
|
29
25
|
var currentValue = String(value);
|
|
30
26
|
var length = currentValue.length;
|
|
31
27
|
if (length !== 10) return false;
|
|
@@ -35,7 +31,6 @@ var ValiDateInvoice = function ValiDateInvoice(value) {
|
|
|
35
31
|
if (!num) return false;
|
|
36
32
|
return true;
|
|
37
33
|
};
|
|
38
|
-
exports.ValiDateInvoice = ValiDateInvoice;
|
|
39
34
|
var Validate = {
|
|
40
35
|
email: ValidateEmail,
|
|
41
36
|
phone: ValidatePhone,
|
|
@@ -43,5 +38,4 @@ var Validate = {
|
|
|
43
38
|
youtubeID: ValidateYoutubeURL,
|
|
44
39
|
invoice: ValiDateInvoice
|
|
45
40
|
};
|
|
46
|
-
var _default = Validate;
|
|
47
|
-
exports["default"] = _default;
|
|
41
|
+
var _default = exports["default"] = Validate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lesca-validate",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "check email, phone number, url format.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,40 +20,40 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@babel/cli": "^7.
|
|
24
|
-
"@babel/core": "^7.
|
|
23
|
+
"@babel/cli": "^7.23.0",
|
|
24
|
+
"@babel/core": "^7.23.2",
|
|
25
25
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
26
26
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
28
|
-
"@babel/preset-env": "^7.
|
|
29
|
-
"@babel/preset-react": "^7.22.
|
|
30
|
-
"@babel/preset-typescript": "^7.
|
|
27
|
+
"@babel/plugin-transform-runtime": "^7.23.2",
|
|
28
|
+
"@babel/preset-env": "^7.23.2",
|
|
29
|
+
"@babel/preset-react": "^7.22.15",
|
|
30
|
+
"@babel/preset-typescript": "^7.23.2",
|
|
31
31
|
"@emotion/react": "^11.11.1",
|
|
32
32
|
"@emotion/styled": "^11.11.0",
|
|
33
|
-
"@mui/icons-material": "^5.14.
|
|
34
|
-
"@mui/material": "^5.14.
|
|
35
|
-
"autoprefixer": "^10.4.
|
|
33
|
+
"@mui/icons-material": "^5.14.13",
|
|
34
|
+
"@mui/material": "^5.14.13",
|
|
35
|
+
"autoprefixer": "^10.4.16",
|
|
36
36
|
"babel-loader": "^9.1.3",
|
|
37
|
-
"concurrently": "^8.2.
|
|
37
|
+
"concurrently": "^8.2.1",
|
|
38
38
|
"copy-and-watch": "^0.1.6",
|
|
39
39
|
"css-loader": "^6.8.1",
|
|
40
40
|
"file-loader": "^6.2.0",
|
|
41
41
|
"gh-pages": "^6.0.0",
|
|
42
|
-
"html-react-parser": "^4.2.
|
|
42
|
+
"html-react-parser": "^4.2.5",
|
|
43
43
|
"html-webpack-plugin": "^5.5.3",
|
|
44
44
|
"less": "^4.2.0",
|
|
45
45
|
"less-loader": "^11.1.3",
|
|
46
46
|
"less-vars-to-js": "^1.3.0",
|
|
47
47
|
"less-watch-compiler": "^1.16.3",
|
|
48
|
-
"postcss": "^8.4.
|
|
48
|
+
"postcss": "^8.4.31",
|
|
49
49
|
"postcss-loader": "^7.3.3",
|
|
50
50
|
"prismjs": "^1.29.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-dom": "^18.2.0",
|
|
53
53
|
"style-loader": "^3.3.3",
|
|
54
|
-
"ts-loader": "^9.
|
|
55
|
-
"typescript": "^5.
|
|
56
|
-
"webpack": "^5.
|
|
54
|
+
"ts-loader": "^9.5.0",
|
|
55
|
+
"typescript": "^5.2.2",
|
|
56
|
+
"webpack": "^5.89.0",
|
|
57
57
|
"webpack-cli": "^5.1.4",
|
|
58
58
|
"webpack-dev-server": "^4.15.1"
|
|
59
59
|
},
|
|
@@ -62,5 +62,8 @@
|
|
|
62
62
|
"repository": {
|
|
63
63
|
"type": "git",
|
|
64
64
|
"url": "git@github.com:jameshsu1125/lesca-validate.git"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@babel/runtime": "^7.23.2"
|
|
65
68
|
}
|
|
66
69
|
}
|