web-component-gallery 1.1.36 → 1.1.37
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/package.json +1 -1
- package/plugins/utils/Filter.js +11 -11
- package/plugins/utils/Validate.js +1 -0
- package/utils/Filter.js +11 -11
- package/utils/Validate.js +1 -0
package/package.json
CHANGED
package/plugins/utils/Filter.js
CHANGED
|
@@ -240,17 +240,17 @@ export function findNthOccurrence(str, charToFind, n) {
|
|
|
240
240
|
*/
|
|
241
241
|
export function handleEnvURL(url, port) {
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
243
|
+
let newUrl
|
|
244
|
+
try {
|
|
245
|
+
newUrl = new URL(url).href
|
|
246
|
+
} catch(error) {
|
|
247
|
+
newUrl = port ?
|
|
248
|
+
location.origin.slice(0, -4) +
|
|
249
|
+
port +
|
|
250
|
+
url.slice(findNthOccurrence(url, '/', 1)) :
|
|
251
|
+
location.origin + url
|
|
252
|
+
}
|
|
253
|
+
return newUrl
|
|
254
254
|
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -10,6 +10,7 @@ export const telephone = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/; //固定电话
|
|
|
10
10
|
export const verifyEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; //检验邮箱
|
|
11
11
|
export const verifyIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //身份证号码 15位或18位
|
|
12
12
|
export const verifyIPStr = /(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}/g; //校验字符串是否包含ip地址
|
|
13
|
+
export const verifyCDN = /^\/\/at\.alicdn\.com\/t\/[cf]\/font_\d+_[a-z0-9]+\.js$/; //校验阿里云CDN链接格式
|
|
13
14
|
|
|
14
15
|
/** 截取字符串中的ip及端口 */
|
|
15
16
|
export function extractIPAndPort(str) {
|
package/utils/Filter.js
CHANGED
|
@@ -240,17 +240,17 @@ export function findNthOccurrence(str, charToFind, n) {
|
|
|
240
240
|
*/
|
|
241
241
|
export function handleEnvURL(url, port) {
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
243
|
+
let newUrl
|
|
244
|
+
try {
|
|
245
|
+
newUrl = new URL(url).href
|
|
246
|
+
} catch(error) {
|
|
247
|
+
newUrl = port ?
|
|
248
|
+
location.origin.slice(0, -4) +
|
|
249
|
+
port +
|
|
250
|
+
url.slice(findNthOccurrence(url, '/', 1)) :
|
|
251
|
+
location.origin + url
|
|
252
|
+
}
|
|
253
|
+
return newUrl
|
|
254
254
|
|
|
255
255
|
}
|
|
256
256
|
|
package/utils/Validate.js
CHANGED
|
@@ -10,6 +10,7 @@ export const telephone = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/; //固定电话
|
|
|
10
10
|
export const verifyEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; //检验邮箱
|
|
11
11
|
export const verifyIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //身份证号码 15位或18位
|
|
12
12
|
export const verifyIPStr = /(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}/g; //校验字符串是否包含ip地址
|
|
13
|
+
export const verifyCDN = /^\/\/at\.alicdn\.com\/t\/[cf]\/font_\d+_[a-z0-9]+\.js$/; //校验阿里云CDN链接格式
|
|
13
14
|
|
|
14
15
|
/** 截取字符串中的ip及端口 */
|
|
15
16
|
export function extractIPAndPort(str) {
|