@fangzhongya/utils 0.0.11 → 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 +18 -15
  10. package/dist/basic/index.d.cts +6 -3
  11. package/dist/basic/index.d.ts +6 -3
  12. package/dist/basic/index.js +17 -14
  13. package/dist/basic/object/index.cjs +14 -8
  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 +13 -7
  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 +15 -4
  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 +14 -3
  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-45M6CPWK.cjs → chunk-4VLLDFBC.cjs} +16 -6
  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-JJLYV6GY.js → chunk-IEQHKLEL.js} +12 -6
  46. package/dist/chunk-JHV27P2Q.cjs +54 -0
  47. package/dist/{chunk-R5TH6GQE.js → chunk-KE6Z4OCB.js} +5 -5
  48. package/dist/{chunk-GIJMEVTJ.js → chunk-N46TJUMT.js} +12 -2
  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-SLRWY5FH.cjs → chunk-UGT4QBTM.cjs} +12 -6
  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 +33 -28
  78. package/dist/index.d.cts +11 -6
  79. package/dist/index.d.ts +11 -6
  80. package/dist/index.js +35 -30
  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 +10 -10
  104. package/dist/urls/index.js +13 -13
  105. package/package.json +31 -6
  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-T7XQBASK.js +0 -28
  110. package/dist/chunk-U5TCBGC3.cjs +0 -28
  111. package/dist/chunk-WMZ6P3AK.cjs +0 -24
  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-LZ7JIJ4I.cjs → chunk-222T3EXB.cjs} +9 -9
  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-X4WTO4NR.js → chunk-JM55S2OL.js} +12 -12
  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,442 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// 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
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+ exports.isEmpty = isEmpty; exports.isNotEmpty = isNotEmpty; exports.isDate = isDate; exports.isDateTime = isDateTime; exports.isAlphaNumeric = isAlphaNumeric; exports.isCnAndEnNumeric = isCnAndEnNumeric; exports.isEnNumeric = isEnNumeric; exports.isCnAndEn = isCnAndEn; exports.isEmail = isEmail; exports.isMoney = isMoney; exports.isNumeric = isNumeric; exports.isNumberFloat = isNumberFloat; exports.isMobile = isMobile; exports.isPhone = isPhone; exports.isFax = isFax; exports.isTel = isTel; exports.isPostalCode = isPostalCode; exports.isURL = isURL; exports.isCardID = isCardID; exports.isPwd = isPwd; exports.isStrongPwd = isStrongPwd; exports.isBankCode = isBankCode; exports.isQq = isQq; exports.isFormatNumber = isFormatNumber; exports.isWeChat = isWeChat;
@@ -0,0 +1,153 @@
1
+ import {
2
+ sortObj
3
+ } from "./chunk-O34QAOO7.js";
4
+
5
+ // packages/tree/splitGroup.ts
6
+ function splitGroupExist(arr, way = "-", isMergeOrder) {
7
+ let arrs = [];
8
+ const obj = {};
9
+ for (let index = 0; index < arr.length; index++) {
10
+ const value = arr[index];
11
+ const vfs = value.split(way);
12
+ const valObj = {
13
+ value
14
+ };
15
+ for (let t = vfs.length - 1; t >= 0; t--) {
16
+ const v = vfs.slice(0, t).join(way);
17
+ if (v) {
18
+ if (arr.includes(v)) {
19
+ valObj.father = v;
20
+ valObj.exist = v;
21
+ obj[v] = obj[v] || {};
22
+ obj[v].children = obj[v].children || [];
23
+ obj[v].children.push(valObj);
24
+ break;
25
+ }
26
+ }
27
+ }
28
+ obj[value] = valObj;
29
+ if (!valObj.father) {
30
+ arrs.push(valObj);
31
+ }
32
+ }
33
+ if (isMergeOrder) {
34
+ const deleteArrs = (arr2, obj2) => {
35
+ let arrs2 = [];
36
+ arr2.forEach((o) => {
37
+ if (o.children) {
38
+ o.children = deleteArrs(o.children, o);
39
+ if (o.children?.length == 1) {
40
+ const z = o?.children[0];
41
+ z.father = obj2.value;
42
+ arrs2.push(z);
43
+ delete o.children;
44
+ }
45
+ }
46
+ arrs2.push(o);
47
+ });
48
+ return sortObj(arrs2, "value");
49
+ };
50
+ arrs = deleteArrs(arrs, {
51
+ value: ""
52
+ });
53
+ }
54
+ return arrs;
55
+ }
56
+ function splitGroupDitto(arr, way = "-", isMergeOrder) {
57
+ let arrs = [];
58
+ const obj = {};
59
+ for (let index = 0; index < arr.length; index++) {
60
+ const value = arr[index];
61
+ const valObj = {
62
+ is: true,
63
+ value
64
+ };
65
+ const vfs = value.split(way);
66
+ valObj.father = vfs.slice(0, vfs.length - 1).join(way);
67
+ for (let t = vfs.length - 1; t >= 0; t--) {
68
+ const v = vfs.slice(0, t).join(way);
69
+ if (v) {
70
+ obj[v] = obj[v] || {
71
+ value: v,
72
+ is: arr.includes(v),
73
+ children: [],
74
+ father: vfs.slice(0, t - 1).join(way)
75
+ };
76
+ obj[v].children = obj[v].children || [];
77
+ if (t == vfs.length - 1) {
78
+ obj[v].children.push(valObj);
79
+ }
80
+ if (arr.includes(v)) {
81
+ valObj.exist = v;
82
+ break;
83
+ }
84
+ if (!obj[v].father) {
85
+ if (!arrs.includes(obj[v])) {
86
+ arrs.push(obj[v]);
87
+ }
88
+ }
89
+ }
90
+ }
91
+ obj[value] = valObj;
92
+ if (!valObj.father) {
93
+ arrs.push(valObj);
94
+ }
95
+ }
96
+ Object.keys(obj).forEach((key) => {
97
+ const o = obj[key];
98
+ if (o.father && !o.is) {
99
+ obj[o.father].children?.push(o);
100
+ }
101
+ });
102
+ if (isMergeOrder) {
103
+ const deleteArrs = (arr2, obj2) => {
104
+ let arrs2 = [];
105
+ for (let index = 0; index < arr2.length; index++) {
106
+ const o = arr2[index];
107
+ if (o.children) {
108
+ o.children = deleteArrs(o.children, o);
109
+ if (o.children) {
110
+ if (!o.is && obj2.children === o.children) {
111
+ obj2.children = o.children;
112
+ obj2.children?.forEach((z) => {
113
+ z.father = obj2.value;
114
+ });
115
+ return sortObj(obj2.children, "value");
116
+ }
117
+ if (o.children?.length == 1) {
118
+ const z = o?.children[0];
119
+ z.father = obj2.value;
120
+ arrs2.push(z);
121
+ delete o.children;
122
+ }
123
+ }
124
+ }
125
+ if (o.is) {
126
+ arrs2.push(o);
127
+ } else {
128
+ if (o.children && o.children.length) {
129
+ arrs2.push(o);
130
+ }
131
+ }
132
+ }
133
+ return sortObj(arrs2, "value");
134
+ };
135
+ arrs = deleteArrs(arrs, {
136
+ value: ""
137
+ });
138
+ }
139
+ return arrs;
140
+ }
141
+ function splitGroup(arr, way = "-", isMergeOrder, type) {
142
+ if (type) {
143
+ return splitGroupDitto(arr, way, isMergeOrder);
144
+ } else {
145
+ return splitGroupExist(arr, way, isMergeOrder);
146
+ }
147
+ }
148
+
149
+ export {
150
+ splitGroupExist,
151
+ splitGroupDitto,
152
+ splitGroup
153
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// 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
+
15
+
16
+ exports.sortObj = sortObj;
@@ -0,0 +1,80 @@
1
+ import {
2
+ isAlphaNumeric,
3
+ isBankCode,
4
+ isCardID,
5
+ isCnAndEn,
6
+ isCnAndEnNumeric,
7
+ isDate,
8
+ isDateTime,
9
+ isEmail,
10
+ isEmpty,
11
+ isEnNumeric,
12
+ isFax,
13
+ isFormatNumber,
14
+ isMobile,
15
+ isMoney,
16
+ isNotEmpty,
17
+ isNumberFloat,
18
+ isNumeric,
19
+ isPhone,
20
+ isPostalCode,
21
+ isPwd,
22
+ isQq,
23
+ isStrongPwd,
24
+ isTel,
25
+ isURL,
26
+ isWeChat
27
+ } from "./chunk-PLNZCEDI.js";
28
+ import {
29
+ matchs
30
+ } from "./chunk-T2QKEABG.js";
31
+ import {
32
+ matchsEnd
33
+ } from "./chunk-YNOFNHEK.js";
34
+ import {
35
+ matchsStart
36
+ } from "./chunk-S6JRKYPY.js";
37
+ import {
38
+ matchsWhole
39
+ } from "./chunk-IRGCP7KH.js";
40
+ import {
41
+ __export
42
+ } from "./chunk-MLKGABMK.js";
43
+
44
+ // packages/judge/index.ts
45
+ var judge_exports = {};
46
+ __export(judge_exports, {
47
+ isAlphaNumeric: () => isAlphaNumeric,
48
+ isBankCode: () => isBankCode,
49
+ isCardID: () => isCardID,
50
+ isCnAndEn: () => isCnAndEn,
51
+ isCnAndEnNumeric: () => isCnAndEnNumeric,
52
+ isDate: () => isDate,
53
+ isDateTime: () => isDateTime,
54
+ isEmail: () => isEmail,
55
+ isEmpty: () => isEmpty,
56
+ isEnNumeric: () => isEnNumeric,
57
+ isFax: () => isFax,
58
+ isFormatNumber: () => isFormatNumber,
59
+ isMobile: () => isMobile,
60
+ isMoney: () => isMoney,
61
+ isNotEmpty: () => isNotEmpty,
62
+ isNumberFloat: () => isNumberFloat,
63
+ isNumeric: () => isNumeric,
64
+ isPhone: () => isPhone,
65
+ isPostalCode: () => isPostalCode,
66
+ isPwd: () => isPwd,
67
+ isQq: () => isQq,
68
+ isStrongPwd: () => isStrongPwd,
69
+ isTel: () => isTel,
70
+ isURL: () => isURL,
71
+ isWeChat: () => isWeChat,
72
+ matchs: () => matchs,
73
+ matchsEnd: () => matchsEnd,
74
+ matchsStart: () => matchsStart,
75
+ matchsWhole: () => matchsWhole
76
+ });
77
+
78
+ export {
79
+ judge_exports
80
+ };
@@ -0,0 +1,9 @@
1
+ import { i as index$1 } from './index-qUiGxoy_.cjs';
2
+ import { i as index$2 } from './index-BU0xla6v.cjs';
3
+ import { i as index$3 } from './index-BzNlzEhU.cjs';
4
+
5
+ declare namespace index {
6
+ export { index$1 as array, index$2 as object, index$3 as string };
7
+ }
8
+
9
+ export { index as i };