@fonixtree/magic-design 2.0.68 → 2.0.69

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.
@@ -287,14 +287,19 @@ var getCoupon = function getCoupon(couponId) {
287
287
  };
288
288
 
289
289
  function isUrl(string) {
290
- var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议
291
- '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
292
- '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
293
- '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口和路径
294
- '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
295
- '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
296
-
297
- return !!pattern.test(string);
290
+ // var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议
291
+ // '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
292
+ // '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
293
+ // '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口和路径
294
+ // '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
295
+ // '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
296
+ // return !!pattern.test(string);
297
+ try {
298
+ new URL(string);
299
+ return true;
300
+ } catch (_) {
301
+ return false;
302
+ }
298
303
  }
299
304
 
300
305
  var clickUrl = function clickUrl(url) {
@@ -287,14 +287,19 @@ var getCoupon = function getCoupon(couponId) {
287
287
  };
288
288
 
289
289
  function isUrl(string) {
290
- var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议
291
- '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
292
- '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
293
- '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口和路径
294
- '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
295
- '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
296
-
297
- return !!pattern.test(string);
290
+ // var pattern = new RegExp('^(https?:\\/\\/)?' + // 协议
291
+ // '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // 域名
292
+ // '((\\d{1,3}\\.){3}\\d{1,3}))' + // 或者 IP (v4) 地址
293
+ // '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // 端口和路径
294
+ // '(\\?[;&a-z\\d%_.~+=-]*)?' + // 查询字符串
295
+ // '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
296
+ // return !!pattern.test(string);
297
+ try {
298
+ new URL(string);
299
+ return true;
300
+ } catch (_) {
301
+ return false;
302
+ }
298
303
  }
299
304
 
300
305
  var clickUrl = function clickUrl(url) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "2.0.68",
4
+ "version": "2.0.69",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",