jk-vue-comps 0.1.19 → 0.2.2

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.
@@ -18,7 +18,7 @@ export declare function isNumber(val: unknown): val is number;
18
18
  /** 是否字符串 */
19
19
  export declare function isString(val: unknown): val is string;
20
20
  /** 是否函数 */
21
- export declare function isFunction(val: unknown): val is Function;
21
+ export declare function isFunction(val: unknown): val is (...args: any[]) => any;
22
22
  /** 是否布尔 */
23
23
  export declare function isBoolean(val: unknown): val is boolean;
24
24
  /** 是否正则 */
@@ -38,15 +38,15 @@ export declare function isElement(val: unknown): val is Element;
38
38
  /** 是否Map */
39
39
  export declare function isMap(val: unknown): val is Map<any, any>;
40
40
  /** 是否服务端渲染,没有window对象 */
41
- export declare const isServer: boolean;
41
+ export declare function isServer(): boolean;
42
42
  /** 是否客户端,window对象不为undefined */
43
- export declare const isClient: boolean;
43
+ export declare function isClient(): boolean;
44
44
  /** 是否url */
45
45
  export declare function isUrl(path: string): boolean;
46
46
  /** 是否Ip */
47
- export declare const isIp: (ip: string) => boolean;
47
+ export declare function isIp(ip: string): boolean;
48
48
  /** 是否邮箱 */
49
- export declare const isEmail: (email: string) => boolean;
49
+ export declare function isEmail(email: string): boolean;
50
50
  /** 是否号码 */
51
51
  export declare function isValidPhoneNumber(phoneNumber: string): boolean;
52
52
  /** 是否移动端浏览器 */
@@ -56,4 +56,4 @@ export declare function isZhLang(lang: string): boolean;
56
56
  /** 是否Edge浏览器 */
57
57
  export declare function isEdgeBrowser(): boolean;
58
58
  /** 是否html字符串 */
59
- export declare const isHtmlStr: (str: string) => boolean;
59
+ export declare function isHtmlStr(str: string): boolean;
package/dist/utils/is.js CHANGED
@@ -1,120 +1,130 @@
1
1
  function e(n, t) {
2
2
  return Object.prototype.toString.call(n) === `[object ${t}]`;
3
3
  }
4
- function p(n) {
4
+ function d(n) {
5
5
  return typeof n < "u";
6
6
  }
7
- function c(n) {
8
- return !p(n);
7
+ function s(n) {
8
+ return !d(n);
9
9
  }
10
- function u(n) {
10
+ function o(n) {
11
11
  return n !== null && e(n, "Object");
12
12
  }
13
- function m(n) {
13
+ function w(n) {
14
14
  return e(n, "Date");
15
15
  }
16
- function d(n) {
16
+ function f(n) {
17
17
  return n === null;
18
18
  }
19
19
  function l(n) {
20
- return c(n) && d(n);
20
+ return s(n) && f(n);
21
21
  }
22
- function y(n) {
23
- return c(n) || d(n);
22
+ function m(n) {
23
+ return s(n) || f(n);
24
24
  }
25
- function A(n) {
25
+ function b(n) {
26
26
  return e(n, "Number");
27
27
  }
28
- function a(n) {
28
+ function c(n) {
29
29
  return e(n, "String");
30
30
  }
31
- function f(n) {
31
+ function u(n) {
32
32
  return typeof n == "function";
33
33
  }
34
- function h(n) {
34
+ function y(n) {
35
35
  return e(n, "Boolean");
36
36
  }
37
- function E(n) {
37
+ function A(n) {
38
38
  return e(n, "RegExp");
39
39
  }
40
- function w(n) {
40
+ function g(n) {
41
41
  return n && Array.isArray(n);
42
42
  }
43
+ function h(n) {
44
+ return g(n) || c(n) ? n.length === 0 : n instanceof Map || n instanceof Set ? n.size === 0 : o(n) ? Object.keys(n).length === 0 : !1;
45
+ }
46
+ function E(n) {
47
+ return e(n, "Promise") && o(n) && u(n.then) && u(n.catch);
48
+ }
43
49
  function N(n) {
44
- return w(n) || a(n) ? n.length === 0 : n instanceof Map || n instanceof Set ? n.size === 0 : u(n) ? Object.keys(n).length === 0 : !1;
50
+ return n instanceof Promise || typeof n?.then == "function";
45
51
  }
46
52
  function P(n) {
47
- return e(n, "Promise") && u(n) && f(n.then) && f(n.catch);
53
+ return typeof window < "u" && e(n, "Window");
48
54
  }
49
55
  function S(n) {
50
- return n instanceof Promise || typeof (n == null ? void 0 : n.then) == "function";
56
+ return o(n) && !!n.tagName;
51
57
  }
52
58
  function Z(n) {
53
- return typeof window < "u" && e(n, "Window");
59
+ return e(n, "Map");
60
+ }
61
+ function p() {
62
+ return typeof window > "u";
54
63
  }
55
- function D(n) {
56
- return u(n) && !!n.tagName;
64
+ function D() {
65
+ return !p();
57
66
  }
58
67
  function M(n) {
59
- return e(n, "Map");
68
+ return /^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?(\/#\/)?(?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/.test(n);
69
+ }
70
+ function O(n) {
71
+ return /\b(?:\d{1,3}.){3}\d{1,3}\b/.test(n);
60
72
  }
61
- const b = typeof window > "u", O = !b;
62
73
  function $(n) {
63
- return /^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?(\/#\/)?(?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/.test(n);
74
+ return /^(([^<>()[\]\\.,;:\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,}))$/.test(n);
64
75
  }
65
- const x = (n) => /\b(?:\d{1,3}.){3}\d{1,3}\b/.test(n), z = (n) => /^(([^<>()[\]\\.,;:\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,}))$/.test(n);
66
- function B(n) {
76
+ function x(n) {
67
77
  const t = /^1[3456789]\d{9}$/, r = /^(\d{3,4}-)?\d{7,8}$/;
68
78
  return !!(t.test(n) || r.test(n));
69
79
  }
70
- function U() {
80
+ function z() {
71
81
  return typeof navigator < "u" && navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i);
72
82
  }
73
- function j(n) {
74
- var i, s;
75
- const t = (s = (i = n == null ? void 0 : n.replace(/\s+/g, "")) == null ? void 0 : i.toUpperCase) == null ? void 0 : s.call(i), r = ["ZH-CN", "ZH_CH", "ZH"], g = ["EN", "EN-US"];
76
- return r.some((o) => o === t) || !g.some((o) => o === t);
83
+ function B(n) {
84
+ const t = n?.replace(/\s+/g, "")?.toUpperCase?.(), r = ["ZH-CN", "ZH_CH", "ZH"], a = ["EN", "EN-US"];
85
+ return r.some((i) => i === t) || !a.some((i) => i === t);
77
86
  }
78
- function H() {
79
- var t;
87
+ function U() {
80
88
  if (navigator.userAgent.indexOf("Edge") > -1)
81
89
  return !0;
82
- const n = ((t = navigator == null ? void 0 : navigator.userAgentData) == null ? void 0 : t.brands) ?? [];
83
- for (const r of n)
84
- if ((r == null ? void 0 : r.brand) === "Microsoft Edge")
90
+ const n = navigator?.userAgentData?.brands ?? [];
91
+ for (const t of n)
92
+ if (t?.brand === "Microsoft Edge")
85
93
  return !0;
86
94
  return !1;
87
95
  }
88
- const _ = (n) => a(n) && /<[^>]+>/g.test(n);
96
+ function j(n) {
97
+ return c(n) && /<[^>]+>/g.test(n);
98
+ }
89
99
  export {
90
100
  e as is,
91
- w as isArray,
92
- h as isBoolean,
93
- O as isClient,
94
- m as isDate,
95
- p as isDef,
96
- H as isEdgeBrowser,
97
- D as isElement,
98
- z as isEmail,
99
- N as isEmpty,
100
- f as isFunction,
101
- _ as isHtmlStr,
102
- U as isInMobileBrowser,
103
- x as isIp,
104
- M as isMap,
105
- d as isNull,
101
+ g as isArray,
102
+ y as isBoolean,
103
+ D as isClient,
104
+ w as isDate,
105
+ d as isDef,
106
+ U as isEdgeBrowser,
107
+ S as isElement,
108
+ $ as isEmail,
109
+ h as isEmpty,
110
+ u as isFunction,
111
+ j as isHtmlStr,
112
+ z as isInMobileBrowser,
113
+ O as isIp,
114
+ Z as isMap,
115
+ f as isNull,
106
116
  l as isNullAndUnDef,
107
- y as isNullOrUnDef,
108
- A as isNumber,
109
- u as isObject,
110
- P as isPromise,
111
- S as isPromiseLink,
112
- E as isRegExp,
113
- b as isServer,
114
- a as isString,
115
- c as isUnDef,
116
- $ as isUrl,
117
- B as isValidPhoneNumber,
118
- Z as isWindow,
119
- j as isZhLang
117
+ m as isNullOrUnDef,
118
+ b as isNumber,
119
+ o as isObject,
120
+ E as isPromise,
121
+ N as isPromiseLink,
122
+ A as isRegExp,
123
+ p as isServer,
124
+ c as isString,
125
+ s as isUnDef,
126
+ M as isUrl,
127
+ x as isValidPhoneNumber,
128
+ P as isWindow,
129
+ B as isZhLang
120
130
  };