@fangzhongya/utils 0.0.9 → 0.0.15

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.
Files changed (124) hide show
  1. package/dist/basic/array/index.cjs +10 -6
  2. package/dist/basic/array/index.d.cts +1 -0
  3. package/dist/basic/array/index.d.ts +1 -0
  4. package/dist/basic/array/index.js +10 -6
  5. package/dist/basic/array/sortObj.cjs +7 -0
  6. package/dist/basic/array/sortObj.d.cts +10 -0
  7. package/dist/basic/array/sortObj.d.ts +10 -0
  8. package/dist/basic/array/sortObj.js +7 -0
  9. package/dist/basic/index.cjs +19 -16
  10. package/dist/basic/index.d.cts +6 -3
  11. package/dist/basic/index.d.ts +6 -3
  12. package/dist/basic/index.js +18 -15
  13. package/dist/basic/object/index.cjs +15 -9
  14. package/dist/basic/object/index.d.cts +1 -0
  15. package/dist/basic/object/index.d.ts +1 -0
  16. package/dist/basic/object/index.js +16 -10
  17. package/dist/basic/object/objValue.cjs +9 -0
  18. package/dist/basic/object/objValue.d.cts +7 -0
  19. package/dist/basic/object/objValue.d.ts +7 -0
  20. package/dist/basic/object/objValue.js +9 -0
  21. package/dist/basic/string/index.cjs +16 -5
  22. package/dist/basic/string/index.d.cts +1 -0
  23. package/dist/basic/string/index.d.ts +1 -0
  24. package/dist/basic/string/index.js +17 -6
  25. package/dist/basic/string/toFunction.cjs +2 -2
  26. package/dist/basic/string/toFunction.d.cts +15 -7
  27. package/dist/basic/string/toFunction.d.ts +15 -7
  28. package/dist/basic/string/toFunction.js +1 -1
  29. package/dist/basic/string/toJson.cjs +3 -3
  30. package/dist/basic/string/toJson.d.cts +2 -5
  31. package/dist/basic/string/toJson.d.ts +2 -5
  32. package/dist/basic/string/toJson.js +2 -2
  33. package/dist/basic/string/toJsons.cjs +15 -0
  34. package/dist/basic/string/toJsons.d.cts +60 -0
  35. package/dist/basic/string/toJsons.d.ts +60 -0
  36. package/dist/basic/string/toJsons.js +15 -0
  37. package/dist/{chunk-76Y73SZE.cjs → chunk-4VLLDFBC.cjs} +17 -7
  38. package/dist/chunk-5HC662VK.js +432 -0
  39. package/dist/{chunk-VQKOHGV5.cjs → chunk-5WOFUMZG.cjs} +8 -4
  40. package/dist/chunk-754Z5VW6.js +29 -0
  41. package/dist/chunk-7O4MJOHM.js +142 -0
  42. package/dist/chunk-E4WBX6J5.cjs +29 -0
  43. package/dist/chunk-ETMYYVQJ.cjs +432 -0
  44. package/dist/{chunk-QJVB3JIZ.js → chunk-HWR2FRME.js} +1 -1
  45. package/dist/{chunk-22VNKNCE.js → chunk-IEQHKLEL.js} +15 -9
  46. package/dist/chunk-JHV27P2Q.cjs +54 -0
  47. package/dist/{chunk-XIMEYSRM.js → chunk-KE6Z4OCB.js} +3 -3
  48. package/dist/{chunk-GV3KYCYT.js → chunk-N46TJUMT.js} +15 -5
  49. package/dist/chunk-O34QAOO7.js +16 -0
  50. package/dist/{chunk-YHLI3SF7.js → chunk-OVHYLUAS.js} +8 -0
  51. package/dist/chunk-PLNZCEDI.js +442 -0
  52. package/dist/{chunk-V5HVA7TW.cjs → chunk-PV2N6PF2.cjs} +8 -0
  53. package/dist/chunk-QXK4IUBI.cjs +142 -0
  54. package/dist/chunk-RYBJGHXK.cjs +153 -0
  55. package/dist/chunk-U3PZBQ6G.js +54 -0
  56. package/dist/{chunk-JMALVLHV.cjs → chunk-UGT4QBTM.cjs} +13 -7
  57. package/dist/chunk-UHKL2RG3.cjs +80 -0
  58. package/dist/{chunk-2KT66KQH.js → chunk-UN6NW2BW.js} +9 -5
  59. package/dist/chunk-UV6KZOFD.cjs +24 -0
  60. package/dist/{chunk-FCCQIHFD.js → chunk-UZ3LZBJ5.js} +1 -1
  61. package/dist/chunk-V2DXOH6B.cjs +442 -0
  62. package/dist/chunk-XQOH3NGZ.js +153 -0
  63. package/dist/chunk-XW3XIK3D.cjs +16 -0
  64. package/dist/chunk-YKNGDK4I.js +80 -0
  65. package/dist/index-6KUSPX5S.d.cts +9 -0
  66. package/dist/index-B7gdHwF9.d.cts +40 -0
  67. package/dist/{index-EY4Ag8_f.d.cts → index-BU0xla6v.d.cts} +4 -1
  68. package/dist/{index-DBBlm0PZ.d.cts → index-BzNlzEhU.d.cts} +7 -1
  69. package/dist/{index-D92-6As_.d.ts → index-C29DFVeC.d.ts} +3 -1
  70. package/dist/index-CPO1AFVg.d.ts +14 -0
  71. package/dist/index-C_7JHW0u.d.ts +9 -0
  72. package/dist/{index-CsP95PJy.d.ts → index-DOq59RNr.d.ts} +4 -1
  73. package/dist/index-DPrdy8Ms.d.ts +40 -0
  74. package/dist/index-cuR7l2XV.d.cts +14 -0
  75. package/dist/{index-BrxHOuw0.d.cts → index-qUiGxoy_.d.cts} +3 -1
  76. package/dist/{index-DjtNMmhM.d.ts → index-rVnsK7Ft.d.ts} +7 -1
  77. package/dist/index.cjs +32 -27
  78. package/dist/index.d.cts +11 -6
  79. package/dist/index.d.ts +11 -6
  80. package/dist/index.js +33 -28
  81. package/dist/judge/index.cjs +57 -5
  82. package/dist/judge/index.d.cts +1 -0
  83. package/dist/judge/index.d.ts +1 -0
  84. package/dist/judge/index.js +57 -5
  85. package/dist/judge/judge.cjs +55 -0
  86. package/dist/judge/judge.d.cts +155 -0
  87. package/dist/judge/judge.d.ts +155 -0
  88. package/dist/judge/judge.js +55 -0
  89. package/dist/judge/matchs.cjs +3 -3
  90. package/dist/judge/matchs.js +2 -2
  91. package/dist/name/index.cjs +3 -3
  92. package/dist/name/index.js +4 -4
  93. package/dist/node/getPort.js +1 -1
  94. package/dist/node/index.js +2 -2
  95. package/dist/tree/index.cjs +11 -2
  96. package/dist/tree/index.d.cts +1 -0
  97. package/dist/tree/index.d.ts +1 -0
  98. package/dist/tree/index.js +10 -1
  99. package/dist/tree/splitGroup.cjs +12 -0
  100. package/dist/tree/splitGroup.d.cts +15 -0
  101. package/dist/tree/splitGroup.d.ts +15 -0
  102. package/dist/tree/splitGroup.js +12 -0
  103. package/dist/urls/index.cjs +4 -4
  104. package/dist/urls/index.js +4 -4
  105. package/package.json +37 -7
  106. package/dist/chunk-6YI3CDEW.js +0 -35
  107. package/dist/chunk-AFKJQ4QP.js +0 -35
  108. package/dist/chunk-JYPJ5QJ5.cjs +0 -35
  109. package/dist/chunk-M3GDD7L3.cjs +0 -24
  110. package/dist/chunk-T7XQBASK.js +0 -28
  111. package/dist/chunk-U5TCBGC3.cjs +0 -28
  112. package/dist/chunk-ZJIRJ4YJ.cjs +0 -35
  113. package/dist/index-BWAB-b69.d.ts +0 -10
  114. package/dist/index-CIOxFVHu.d.ts +0 -9
  115. package/dist/index-CVNtXK0N.d.ts +0 -14
  116. package/dist/index-D-5HNg2W.d.cts +0 -14
  117. package/dist/index-DTk8hXm8.d.cts +0 -10
  118. package/dist/index-DfmnOk56.d.cts +0 -9
  119. package/dist/{chunk-OXTC52IL.cjs → chunk-222T3EXB.cjs} +3 -3
  120. package/dist/{chunk-IVDRKJ33.js → chunk-BFN33JM5.js} +3 -3
  121. package/dist/{chunk-ZXWKQRGH.cjs → chunk-BG2YS767.cjs} +2 -2
  122. package/dist/{chunk-WVG4AW4U.js → chunk-JM55S2OL.js} +3 -3
  123. package/dist/{chunk-NGQKVTCR.cjs → chunk-T22I7TJQ.cjs} +3 -3
  124. package/dist/{chunk-FRGDQOX4.js → chunk-T2QKEABG.js} +3 -3
@@ -0,0 +1,54 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkQXK4IUBIcjs = require('./chunk-QXK4IUBI.cjs');
4
+
5
+ // packages/basic/string/toJson.ts
6
+ function toJSONStringify(obj, space) {
7
+ return JSON.stringify(
8
+ obj,
9
+ (_, value) => {
10
+ if (typeof value === "symbol") {
11
+ return { __type: "symbol", value: value.description };
12
+ } else if (typeof value === "function") {
13
+ return {
14
+ __type: "function",
15
+ value: value.toString()
16
+ };
17
+ } else if (value === void 0) {
18
+ return { __type: "undefined" };
19
+ } else if (value instanceof Date) {
20
+ return { __type: "Date", value: value.toISOString() };
21
+ } else if (value instanceof RegExp) {
22
+ return { __type: "RegExp", value: value.toString() };
23
+ }
24
+ return value;
25
+ },
26
+ space
27
+ );
28
+ }
29
+ function toJSONParse(str, reviver) {
30
+ return JSON.parse(str, (key, value) => {
31
+ if (value && typeof value === "object") {
32
+ switch (value.__type) {
33
+ case "symbol":
34
+ return Symbol(value.value);
35
+ case "function":
36
+ return _chunkQXK4IUBIcjs.toFunction.call(void 0, value.value) || value;
37
+ case "undefined":
38
+ return void 0;
39
+ case "Date":
40
+ return new Date(value.value);
41
+ case "RegExp": {
42
+ const match = value.value.match(/\/(.*)\/([gimuy]*)/);
43
+ return match ? new RegExp(match[1], match[2]) : value;
44
+ }
45
+ }
46
+ }
47
+ return reviver ? reviver(key, value) : value;
48
+ });
49
+ }
50
+
51
+
52
+
53
+
54
+ exports.toJSONStringify = toJSONStringify; exports.toJSONParse = toJSONParse;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  string_exports
3
- } from "./chunk-GV3KYCYT.js";
3
+ } from "./chunk-N46TJUMT.js";
4
4
  import {
5
5
  object_exports
6
- } from "./chunk-22VNKNCE.js";
6
+ } from "./chunk-IEQHKLEL.js";
7
7
  import {
8
8
  array_exports
9
- } from "./chunk-2KT66KQH.js";
9
+ } from "./chunk-UN6NW2BW.js";
10
10
  import {
11
11
  __export
12
12
  } from "./chunk-MLKGABMK.js";
@@ -1,17 +1,23 @@
1
+ import {
2
+ getStartSame
3
+ } from "./chunk-7DTHADVK.js";
1
4
  import {
2
5
  splitUpper
3
6
  } from "./chunk-VKE5JARB.js";
4
7
  import {
5
8
  toJSONParse,
6
9
  toJSONStringify
7
- } from "./chunk-AFKJQ4QP.js";
10
+ } from "./chunk-U3PZBQ6G.js";
11
+ import {
12
+ serializeCodeBlock,
13
+ serializeFunctionRef,
14
+ toJSONSParse,
15
+ toJSONSStringify
16
+ } from "./chunk-5HC662VK.js";
8
17
  import {
9
18
  getFunctionFormat,
10
19
  toFunction
11
- } from "./chunk-6YI3CDEW.js";
12
- import {
13
- getStartSame
14
- } from "./chunk-7DTHADVK.js";
20
+ } from "./chunk-7O4MJOHM.js";
15
21
  import {
16
22
  appearNum
17
23
  } from "./chunk-SNABGVNO.js";
@@ -41,9 +47,13 @@ __export(string_exports, {
41
47
  getFunctionFormat: () => getFunctionFormat,
42
48
  getStartSame: () => getStartSame,
43
49
  getStartSames: () => getStartSames,
50
+ serializeCodeBlock: () => serializeCodeBlock,
51
+ serializeFunctionRef: () => serializeFunctionRef,
44
52
  splitUpper: () => splitUpper,
45
53
  toFunction: () => toFunction,
46
54
  toJSONParse: () => toJSONParse,
55
+ toJSONSParse: () => toJSONSParse,
56
+ toJSONSStringify: () => toJSONSStringify,
47
57
  toJSONStringify: () => toJSONStringify
48
58
  });
49
59
 
@@ -0,0 +1,16 @@
1
+ // packages/basic/array/sortObj.ts
2
+ function sortObj(arr, value) {
3
+ return arr.sort((a, b) => {
4
+ if (a[value] > b[value]) {
5
+ return 1;
6
+ } else if (a[value] < b[value]) {
7
+ return -1;
8
+ } else {
9
+ return 0;
10
+ }
11
+ });
12
+ }
13
+
14
+ export {
15
+ sortObj
16
+ };
@@ -3,6 +3,11 @@ import {
3
3
  getTreeObj,
4
4
  treeToArray
5
5
  } from "./chunk-GVVJIN46.js";
6
+ import {
7
+ splitGroup,
8
+ splitGroupDitto,
9
+ splitGroupExist
10
+ } from "./chunk-XQOH3NGZ.js";
6
11
  import {
7
12
  __export
8
13
  } from "./chunk-MLKGABMK.js";
@@ -12,6 +17,9 @@ var tree_exports = {};
12
17
  __export(tree_exports, {
13
18
  arrayToTree: () => arrayToTree,
14
19
  getTreeObj: () => getTreeObj,
20
+ splitGroup: () => splitGroup,
21
+ splitGroupDitto: () => splitGroupDitto,
22
+ splitGroupExist: () => splitGroupExist,
15
23
  treeToArray: () => treeToArray
16
24
  });
17
25
 
@@ -0,0 +1,442 @@
1
+ // packages/judge/judge.ts
2
+ function judgeTest(a, b) {
3
+ return a.test(b);
4
+ }
5
+ function isEmpty(str) {
6
+ return typeof str == "undefined" || str == null || (str = str + "", str.trim() == "" || str.trim() == "undefined" || str.trim() == "null");
7
+ }
8
+ function isNotEmpty(str) {
9
+ return !isEmpty(str);
10
+ }
11
+ function isDate(strValue) {
12
+ if (isEmpty(strValue)) return false;
13
+ let r = strValue.match(/^(\d{4})(-|\/)(\d{2})\2(\d{2})$/);
14
+ if (r == null) return false;
15
+ let d = new Date(Number(r[1]), Number(r[3]) - 1, Number(r[4]));
16
+ return d.getFullYear() == Number(r[1]) && d.getMonth() + 1 == Number(r[3]) && d.getDate() == Number(r[4]);
17
+ }
18
+ function isDateTime(str) {
19
+ let reg = /^(\d{4})(-|\/)(\d{2})\2(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;
20
+ let r = str.match(reg);
21
+ if (r == null) return false;
22
+ let d = new Date(
23
+ Number(r[1]),
24
+ Number(r[3]) - 1,
25
+ Number(r[4]),
26
+ Number(r[5]),
27
+ Number(r[6]),
28
+ Number(r[7])
29
+ );
30
+ return d.getFullYear() == Number(r[1]) && d.getMonth() + 1 == Number(r[3]) && d.getDate() == Number(r[4]) && d.getHours() == Number(r[5]) && d.getMinutes() == Number(r[6]) && d.getSeconds() == Number(r[7]);
31
+ }
32
+ function isAlphaNumeric(strValue) {
33
+ if (isEmpty(strValue)) return false;
34
+ let pattern = /^[A-Za-z0-9]+$/;
35
+ return judgeTest(pattern, strValue);
36
+ }
37
+ function isCnAndEnNumeric(strValue) {
38
+ let pattern = /^[_0-9a-zA-Z\u4e00-\u9fa5]+$/;
39
+ return judgeTest(pattern, strValue);
40
+ }
41
+ function isEnNumeric(strValue) {
42
+ let pattern = /^[_0-9a-zA-Z]+$/;
43
+ return judgeTest(pattern, strValue);
44
+ }
45
+ function isCnAndEn(strValue) {
46
+ if (isEmpty(strValue)) return false;
47
+ let pattern = /^[\u4e00-\u9fa5]+$/;
48
+ return judgeTest(pattern, strValue);
49
+ }
50
+ function isEmail(strValue) {
51
+ if (isEmpty(strValue)) return false;
52
+ let pattern = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
53
+ return judgeTest(pattern, strValue);
54
+ }
55
+ function isMoney(strValue) {
56
+ if (isEmpty(strValue)) return false;
57
+ let pattern = /^[+-]?\d+(,\d{3})*(\.\d+)?$/;
58
+ return judgeTest(pattern, strValue);
59
+ }
60
+ function isNumeric(strValue) {
61
+ if (isEmpty(strValue)) return false;
62
+ let pattern = /^[0-9]*$/;
63
+ return judgeTest(pattern, strValue);
64
+ }
65
+ function isNumberFloat(strValue) {
66
+ if (isEmpty(strValue)) return false;
67
+ let pattern = /^\d+(\.\d+)?$/;
68
+ return judgeTest(pattern, strValue);
69
+ }
70
+ function isMobile(strValue) {
71
+ if (isEmpty(strValue)) return false;
72
+ let pattern = /^(1)[0-9]{10}$/;
73
+ return judgeTest(pattern, strValue);
74
+ }
75
+ function isPhone(strValue) {
76
+ if (isEmpty(strValue)) return false;
77
+ let pattern = /(^\(\d{3,5}\)\d{6,8}(-\d{2,8})?$)|(^\d+-\d+$)|(^(1)[0-9]{10}$)/;
78
+ return judgeTest(pattern, strValue);
79
+ }
80
+ function isFax(strValue) {
81
+ if (isEmpty(strValue)) return false;
82
+ let pattern = /^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/;
83
+ return judgeTest(pattern, strValue);
84
+ }
85
+ function isTel(strValue) {
86
+ if (isEmpty(strValue)) return false;
87
+ let pattern = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
88
+ return judgeTest(pattern, strValue);
89
+ }
90
+ function isPostalCode(strValue) {
91
+ if (isEmpty(strValue)) return false;
92
+ let pattern = /(^\d{6}$)/;
93
+ return judgeTest(pattern, strValue);
94
+ }
95
+ function isURL(strValue) {
96
+ if (isEmpty(strValue)) return false;
97
+ let pattern = /^(http|https|ftp):\/\/(\w+\.)+[a-z]{2,3}(\/\w+)*(\/\w+\.\w+)*(\?\w+=\w*(&\w+=\w*)*)*/;
98
+ return judgeTest(pattern, strValue);
99
+ }
100
+ function isCardID(strValue) {
101
+ if (isEmpty(strValue)) {
102
+ return false;
103
+ }
104
+ strValue = strValue.toUpperCase();
105
+ let vcity = {
106
+ 11: "\u5317\u4EAC",
107
+ 12: "\u5929\u6D25",
108
+ 13: "\u6CB3\u5317",
109
+ 14: "\u5C71\u897F",
110
+ 15: "\u5185\u8499\u53E4",
111
+ 21: "\u8FBD\u5B81",
112
+ 22: "\u5409\u6797",
113
+ 23: "\u9ED1\u9F99\u6C5F",
114
+ 31: "\u4E0A\u6D77",
115
+ 32: "\u6C5F\u82CF",
116
+ 33: "\u6D59\u6C5F",
117
+ 34: "\u5B89\u5FBD",
118
+ 35: "\u798F\u5EFA",
119
+ 36: "\u6C5F\u897F",
120
+ 37: "\u5C71\u4E1C",
121
+ 41: "\u6CB3\u5357",
122
+ 42: "\u6E56\u5317",
123
+ 43: "\u6E56\u5357",
124
+ 44: "\u5E7F\u4E1C",
125
+ 45: "\u5E7F\u897F",
126
+ 46: "\u6D77\u5357",
127
+ 50: "\u91CD\u5E86",
128
+ 51: "\u56DB\u5DDD",
129
+ 52: "\u8D35\u5DDE",
130
+ 53: "\u4E91\u5357",
131
+ 54: "\u897F\u85CF",
132
+ 61: "\u9655\u897F",
133
+ 62: "\u7518\u8083",
134
+ 63: "\u9752\u6D77",
135
+ 64: "\u5B81\u590F",
136
+ 65: "\u65B0\u7586",
137
+ 71: "\u53F0\u6E7E",
138
+ 81: "\u9999\u6E2F",
139
+ 82: "\u6FB3\u95E8",
140
+ 91: "\u56FD\u5916"
141
+ };
142
+ let pattern = /(^\d{15}$)|(^\d{17}(\d|X)$)/;
143
+ if (judgeTest(pattern, strValue) === false) {
144
+ return false;
145
+ }
146
+ let province = strValue.substring(0, 2);
147
+ if (vcity[province] == void 0) {
148
+ return false;
149
+ }
150
+ let len = strValue.length;
151
+ if (len == 15) {
152
+ let re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/;
153
+ let arr_data = strValue.match(re_fifteen) || [];
154
+ let year = Number("19" + arr_data[2]);
155
+ let month = Number(arr_data[3]);
156
+ let day = Number(arr_data[4]);
157
+ let birthday = /* @__PURE__ */ new Date("19" + year + "/" + month + "/" + day);
158
+ birthday.setFullYear(year);
159
+ birthday.setMonth(month - 1);
160
+ birthday.setDate(day);
161
+ let now = /* @__PURE__ */ new Date();
162
+ let now_year = now.getFullYear();
163
+ if (birthday.getFullYear() == year && birthday.getMonth() + 1 == month && birthday.getDate() == day) {
164
+ let time = now_year - year;
165
+ if (!(time >= 3 && time <= 200)) {
166
+ return false;
167
+ }
168
+ } else {
169
+ return false;
170
+ }
171
+ }
172
+ if (len == 18) {
173
+ let re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/;
174
+ let arr_data = strValue.match(re_eighteen) || [];
175
+ let year = Number(arr_data[2]);
176
+ let month = Number(arr_data[3]);
177
+ let day = Number(arr_data[4]);
178
+ let birthday = /* @__PURE__ */ new Date(year + "/" + month + "/" + day);
179
+ birthday.setFullYear(year);
180
+ birthday.setMonth(month - 1);
181
+ birthday.setDate(day);
182
+ let now = /* @__PURE__ */ new Date();
183
+ let now_year = now.getFullYear();
184
+ if (birthday.getFullYear() == year && birthday.getMonth() + 1 == month && birthday.getDate() == day) {
185
+ let time = now_year - year;
186
+ if (!(time >= 3 && time <= 200)) {
187
+ return false;
188
+ }
189
+ } else {
190
+ return false;
191
+ }
192
+ }
193
+ if (strValue.length == 15) {
194
+ let arrInt = new Array(
195
+ 7,
196
+ 9,
197
+ 10,
198
+ 5,
199
+ 8,
200
+ 4,
201
+ 2,
202
+ 1,
203
+ 6,
204
+ 3,
205
+ 7,
206
+ 9,
207
+ 10,
208
+ 5,
209
+ 8,
210
+ 4,
211
+ 2
212
+ );
213
+ let arrCh = new Array(
214
+ "1",
215
+ "0",
216
+ "X",
217
+ "9",
218
+ "8",
219
+ "7",
220
+ "6",
221
+ "5",
222
+ "4",
223
+ "3",
224
+ "2"
225
+ );
226
+ let cardTemp = 0, i;
227
+ strValue = strValue.substring(0, 6) + "19" + strValue.substring(6, strValue.length - 6);
228
+ for (i = 0; i < 17; i++) {
229
+ cardTemp += Number(strValue.substring(i, 1)) * arrInt[i];
230
+ }
231
+ strValue += arrCh[cardTemp % 11];
232
+ }
233
+ if (strValue.length == 18) {
234
+ let arrInt = new Array(
235
+ 7,
236
+ 9,
237
+ 10,
238
+ 5,
239
+ 8,
240
+ 4,
241
+ 2,
242
+ 1,
243
+ 6,
244
+ 3,
245
+ 7,
246
+ 9,
247
+ 10,
248
+ 5,
249
+ 8,
250
+ 4,
251
+ 2
252
+ );
253
+ let arrCh = new Array(
254
+ "1",
255
+ "0",
256
+ "X",
257
+ "9",
258
+ "8",
259
+ "7",
260
+ "6",
261
+ "5",
262
+ "4",
263
+ "3",
264
+ "2"
265
+ );
266
+ let cardTemp = 0, i, valnum;
267
+ for (i = 0; i < 17; i++) {
268
+ cardTemp += Number.parseInt(strValue.substring(i, 1)) * arrInt[i];
269
+ }
270
+ valnum = arrCh[cardTemp % 11];
271
+ if (valnum != strValue.substring(17, 1)) {
272
+ return false;
273
+ }
274
+ }
275
+ return true;
276
+ }
277
+ function isPwd(strValue) {
278
+ if (isEmpty(strValue)) return false;
279
+ let pattern = /^[0-9]{6}$/;
280
+ return judgeTest(pattern, strValue);
281
+ }
282
+ function isStrongPwd(strValue, filters = []) {
283
+ if (!judgeTest(/^\d{6}$/, strValue)) return false;
284
+ if (judgeTest(/([\d])\1{2}/, strValue)) return false;
285
+ let str = strValue.replace(/\d/g, ($0, pos) => {
286
+ return Number.parseInt($0) - Number.parseInt(pos) + "";
287
+ });
288
+ if (judgeTest(/^(\d)\1+$/, str)) return false;
289
+ str = strValue.replace(/\d/g, ($0, pos) => {
290
+ return Number.parseInt($0) + pos;
291
+ });
292
+ if (judgeTest(/^(\d)\1+$/, str)) return false;
293
+ let temp = "";
294
+ for (let i = 0; i < strValue.length; i++) {
295
+ let c = strValue.charAt(i);
296
+ if (temp.indexOf(c) == -1) {
297
+ temp += c;
298
+ }
299
+ }
300
+ if (temp.length <= 2) return false;
301
+ let flag = true;
302
+ let map = {};
303
+ for (let i = 0; i < strValue.length; i++) {
304
+ let c = strValue.charAt(i);
305
+ if (isEmpty(map[c])) {
306
+ map[c] = 0;
307
+ }
308
+ map[c] = map[c] + 1;
309
+ if (map[c] >= strValue.length / 2) {
310
+ flag = false;
311
+ }
312
+ }
313
+ if (flag == false) {
314
+ return false;
315
+ }
316
+ if (filters && filters.length > 0) {
317
+ for (let i = 0; i < filters.length; i++) {
318
+ let filter = filters[i];
319
+ if (filter.indexOf(strValue) > -1) {
320
+ return false;
321
+ }
322
+ }
323
+ }
324
+ return true;
325
+ }
326
+ function isBankCode(strValue) {
327
+ strValue = strValue.trim();
328
+ if (!isNumeric(strValue)) {
329
+ return false;
330
+ }
331
+ let length = strValue.length;
332
+ if (length < 12) {
333
+ return false;
334
+ } else if (length > 19 || length == 18) {
335
+ return true;
336
+ }
337
+ let flag = true;
338
+ let i = 0, mark = 0, temp = 0;
339
+ while (i < length - 1) {
340
+ mark += Number.parseInt(strValue.charAt(i));
341
+ i++;
342
+ temp = Number.parseInt(strValue.charAt(i)) * 2;
343
+ i++;
344
+ mark = Math.floor(temp / 10) + temp % 10;
345
+ }
346
+ if (mark % 10 == 0) {
347
+ flag = true;
348
+ } else {
349
+ flag = Number.parseInt(strValue.charAt(length - 1)) == 10 - mark % 10 || Number.parseInt(strValue.charAt(length - 1)) == mark % 10;
350
+ }
351
+ if (!flag) {
352
+ let lastNum = strValue.substring(
353
+ strValue.length - 1,
354
+ 1
355
+ );
356
+ let first15Num = strValue.substring(0, strValue.length - 1);
357
+ let newArr = [];
358
+ for (let i2 = first15Num.length - 1; i2 > -1; i2--) {
359
+ newArr.push(first15Num.substring(i2, 1));
360
+ }
361
+ let arrJiShu = [];
362
+ let arrJiShu2 = [];
363
+ let arrOuShu = [];
364
+ for (let j = 0; j < newArr.length; j++) {
365
+ if ((j + 1) % 2 == 1) {
366
+ if (Number.parseInt(newArr[j]) * 2 < 9)
367
+ arrJiShu.push(Number.parseInt(newArr[j]) * 2);
368
+ else arrJiShu2.push(Number.parseInt(newArr[j]) * 2);
369
+ } else arrOuShu.push(newArr[j]);
370
+ }
371
+ let jishu_child1 = [];
372
+ let jishu_child2 = [];
373
+ for (let h = 0; h < arrJiShu2.length; h++) {
374
+ jishu_child1.push(arrJiShu2[h] % 10);
375
+ jishu_child2.push(arrJiShu2[h] / 10);
376
+ }
377
+ let sumJiShu = 0;
378
+ let sumOuShu = 0;
379
+ let sumJiShuChild1 = 0;
380
+ let sumJiShuChild2 = 0;
381
+ let sumTotal = 0;
382
+ for (let m = 0; m < arrJiShu.length; m++) {
383
+ sumJiShu = sumJiShu + arrJiShu[m];
384
+ }
385
+ for (let n = 0; n < arrOuShu.length; n++) {
386
+ sumOuShu = sumOuShu + Number.parseInt(arrOuShu[n]);
387
+ }
388
+ for (let p = 0; p < jishu_child1.length; p++) {
389
+ sumJiShuChild1 = sumJiShuChild1 + jishu_child1[p];
390
+ sumJiShuChild2 = sumJiShuChild2 + jishu_child2[p];
391
+ }
392
+ sumTotal = sumJiShu + sumOuShu + sumJiShuChild1 + sumJiShuChild2;
393
+ let k = sumTotal % 10 == 0 ? 10 : sumTotal % 10;
394
+ let luhm = 10 - k;
395
+ lastNum = Number.parseInt(lastNum);
396
+ flag = lastNum == luhm || luhm % lastNum == 0 || lastNum % luhm == 0 || lastNum + luhm == 10;
397
+ }
398
+ return flag;
399
+ }
400
+ function isQq(a) {
401
+ if (isEmpty(a)) return false;
402
+ let d = /^[1-9]\d{4,11}$/;
403
+ return judgeTest(d, a);
404
+ }
405
+ function isFormatNumber(a, b = 2) {
406
+ if (isEmpty(a)) return false;
407
+ let d = new RegExp("^[0-9]+.[0-9]{" + b + "}$");
408
+ return judgeTest(d, a);
409
+ }
410
+ function isWeChat(a) {
411
+ if (isEmpty(a)) return false;
412
+ let d = /^[a-zA-Z]([-_a-zA-Z0-9]{5,19})+$/;
413
+ return judgeTest(d, a);
414
+ }
415
+
416
+ export {
417
+ isEmpty,
418
+ isNotEmpty,
419
+ isDate,
420
+ isDateTime,
421
+ isAlphaNumeric,
422
+ isCnAndEnNumeric,
423
+ isEnNumeric,
424
+ isCnAndEn,
425
+ isEmail,
426
+ isMoney,
427
+ isNumeric,
428
+ isNumberFloat,
429
+ isMobile,
430
+ isPhone,
431
+ isFax,
432
+ isTel,
433
+ isPostalCode,
434
+ isURL,
435
+ isCardID,
436
+ isPwd,
437
+ isStrongPwd,
438
+ isBankCode,
439
+ isQq,
440
+ isFormatNumber,
441
+ isWeChat
442
+ };
@@ -5,6 +5,11 @@
5
5
  var _chunkYAD5PHVFcjs = require('./chunk-YAD5PHVF.cjs');
6
6
 
7
7
 
8
+
9
+
10
+ var _chunkRYBJGHXKcjs = require('./chunk-RYBJGHXK.cjs');
11
+
12
+
8
13
  var _chunk75ZPJI57cjs = require('./chunk-75ZPJI57.cjs');
9
14
 
10
15
  // packages/tree/index.ts
@@ -12,6 +17,9 @@ var tree_exports = {};
12
17
  _chunk75ZPJI57cjs.__export.call(void 0, tree_exports, {
13
18
  arrayToTree: () => _chunkYAD5PHVFcjs.arrayToTree,
14
19
  getTreeObj: () => _chunkYAD5PHVFcjs.getTreeObj,
20
+ splitGroup: () => _chunkRYBJGHXKcjs.splitGroup,
21
+ splitGroupDitto: () => _chunkRYBJGHXKcjs.splitGroupDitto,
22
+ splitGroupExist: () => _chunkRYBJGHXKcjs.splitGroupExist,
15
23
  treeToArray: () => _chunkYAD5PHVFcjs.treeToArray
16
24
  });
17
25