@zwa73/utils 1.0.206 → 1.0.207

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 (48) hide show
  1. package/dist/QuickExport.d.ts +1 -2
  2. package/dist/QuickExport.js +27 -22
  3. package/dist/UtilClass.d.ts +1 -98
  4. package/dist/UtilClass.js +5 -242
  5. package/dist/UtilCom.d.ts +1 -1
  6. package/dist/UtilDecorators.d.ts +1 -32
  7. package/dist/UtilDecorators.js +15 -225
  8. package/dist/UtilFunctions.d.ts +9 -267
  9. package/dist/UtilFunctions.js +38 -687
  10. package/dist/UtilI18n.js +1 -1
  11. package/dist/UtilInterfaces.d.ts +1 -180
  12. package/dist/UtilInterfaces.js +1 -0
  13. package/dist/UtilLogger.d.ts +19 -20
  14. package/dist/UtilLogger.js +1 -1
  15. package/dist/UtilSymbol.d.ts +1 -40
  16. package/dist/UtilSymbol.js +11 -27
  17. package/dist/index.js +3 -0
  18. package/dist/test/dist/bitcont.d.ts +1 -0
  19. package/dist/test/dist/bitcont.js +153 -0
  20. package/dist/test/dist/error.d.ts +1 -0
  21. package/dist/test/dist/error.js +11 -0
  22. package/dist/test/dist/fptest.d.ts +1 -0
  23. package/dist/test/dist/fptest.js +21 -0
  24. package/dist/test/dist/hbs.d.ts +1 -0
  25. package/dist/test/dist/hbs.js +14 -0
  26. package/dist/test/dist/ip.d.ts +1 -0
  27. package/dist/test/dist/ip.js +107 -0
  28. package/dist/test/dist/llonebot.d.ts +0 -0
  29. package/dist/test/dist/llonebot.js +1 -0
  30. package/dist/test/dist/log.d.ts +1 -0
  31. package/dist/test/dist/log.js +9 -0
  32. package/dist/test/dist/match.d.ts +1 -0
  33. package/dist/test/dist/match.js +19 -0
  34. package/dist/test/dist/pathe.d.ts +1 -0
  35. package/dist/test/dist/pathe.js +7 -0
  36. package/dist/test/dist/queuetest.d.ts +1 -0
  37. package/dist/test/dist/queuetest.js +139 -0
  38. package/dist/test/dist/regtest.d.ts +1 -0
  39. package/dist/test/dist/regtest.js +8 -0
  40. package/dist/test/dist/repeatTest.d.ts +1 -0
  41. package/dist/test/dist/repeatTest.js +120 -0
  42. package/dist/test/dist/stringifytest.d.ts +1 -0
  43. package/dist/test/dist/stringifytest.js +8 -0
  44. package/dist/test/dist/test2.d.ts +1 -0
  45. package/dist/test/dist/test2.js +35 -0
  46. package/dist/test/dist/testStream.d.ts +1 -0
  47. package/dist/test/dist/testStream.js +286 -0
  48. package/package.json +3 -1
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b)
7
+ if (b.hasOwnProperty(p))
8
+ d[p] = b[p]; };
9
+ return extendStatics(d, b);
10
+ };
11
+ return function (d, b) {
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try {
21
+ step(generator.next(value));
22
+ }
23
+ catch (e) {
24
+ reject(e);
25
+ } }
26
+ function rejected(value) { try {
27
+ step(generator["throw"](value));
28
+ }
29
+ catch (e) {
30
+ reject(e);
31
+ } }
32
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
33
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
34
+ });
35
+ };
36
+ var __generator = (this && this.__generator) || function (thisArg, body) {
37
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
38
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f)
43
+ throw new TypeError("Generator is already executing.");
44
+ while (_)
45
+ try {
46
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
47
+ return t;
48
+ if (y = 0, t)
49
+ op = [op[0] & 2, t.value];
50
+ switch (op[0]) {
51
+ case 0:
52
+ case 1:
53
+ t = op;
54
+ break;
55
+ case 4:
56
+ _.label++;
57
+ return { value: op[1], done: false };
58
+ case 5:
59
+ _.label++;
60
+ y = op[1];
61
+ op = [0];
62
+ continue;
63
+ case 7:
64
+ op = _.ops.pop();
65
+ _.trys.pop();
66
+ continue;
67
+ default:
68
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
69
+ _ = 0;
70
+ continue;
71
+ }
72
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
73
+ _.label = op[1];
74
+ break;
75
+ }
76
+ if (op[0] === 6 && _.label < t[1]) {
77
+ _.label = t[1];
78
+ t = op;
79
+ break;
80
+ }
81
+ if (t && _.label < t[2]) {
82
+ _.label = t[2];
83
+ _.ops.push(op);
84
+ break;
85
+ }
86
+ if (t[2])
87
+ _.ops.pop();
88
+ _.trys.pop();
89
+ continue;
90
+ }
91
+ op = body.call(thisArg, _);
92
+ }
93
+ catch (e) {
94
+ op = [6, e];
95
+ y = 0;
96
+ }
97
+ finally {
98
+ f = t = 0;
99
+ }
100
+ if (op[0] & 5)
101
+ throw op[1];
102
+ return { value: op[0] ? op[1] : void 0, done: true };
103
+ }
104
+ };
105
+ var __spreadArrays = (this && this.__spreadArrays) || function () {
106
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
107
+ s += arguments[i].length;
108
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
109
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
110
+ r[k] = a[j];
111
+ return r;
112
+ };
113
+ exports.__esModule = true;
114
+ var __1 = require("../");
115
+ /**并行流 */
116
+ var TStream = /** @class */ (function (_super) {
117
+ __extends(TStream, _super);
118
+ function TStream(base, concurrent) {
119
+ if (concurrent === void 0) {
120
+ concurrent = 1;
121
+ }
122
+ var _this = this;
123
+ /**加工函数列表*/
124
+ _this._operation = [];
125
+ if (base == undefined)
126
+ _this = _super.call(this) || this;
127
+ else if (typeof base === 'number')
128
+ _this = _super.call(this, base) || this;
129
+ else
130
+ _this = _super.apply(this, base) || this;
131
+ _this._concurrent = concurrent;
132
+ return _this;
133
+ }
134
+ /**平分数组
135
+ * @param count - 份数
136
+ * @param mode - 模式 average:轮询平均分 chunk:切块均分
137
+ * @returns 新数组
138
+ */
139
+ TStream.prototype.divide = function (count, mode) {
140
+ var _this = this;
141
+ if (mode === void 0) {
142
+ mode = "average";
143
+ }
144
+ if (count <= 0)
145
+ return [];
146
+ if (count == 1)
147
+ return [__spreadArrays(this)];
148
+ var size = this.length;
149
+ var result = [];
150
+ __1.matchProc(mode, {
151
+ //轮询平均分
152
+ 'average': function () {
153
+ for (var i = 0; i < count; i++) {
154
+ var clist = [];
155
+ for (var j = i; j < size; j += count)
156
+ clist.push(_this[j]);
157
+ result.push(clist);
158
+ }
159
+ },
160
+ //切块均分
161
+ 'chunk': function () {
162
+ var chunkSize = Math.ceil(size / count);
163
+ for (var i = 0; i < count; i++) {
164
+ var start = i * chunkSize;
165
+ var end = (i + 1) * chunkSize;
166
+ if (end > size)
167
+ end = size;
168
+ result.push(_this.slice(start, end));
169
+ }
170
+ }
171
+ });
172
+ return result;
173
+ };
174
+ /**流映射加工
175
+ * @param operation - 加工函数
176
+ * @returns 新流
177
+ */
178
+ TStream.prototype.stmMap = function (operation) {
179
+ this._operation.push(operation);
180
+ return this;
181
+ };
182
+ /**流遍历
183
+ * 返回自身
184
+ * @param operation - 遍历函数
185
+ * @returns 自身
186
+ */
187
+ TStream.prototype.stmEach = function (operation) {
188
+ var _this = this;
189
+ var opera = function (item) {
190
+ return __awaiter(_this, void 0, void 0, function () {
191
+ return __generator(this, function (_a) {
192
+ operation(item);
193
+ return [2 /*return*/, item];
194
+ });
195
+ });
196
+ };
197
+ this._operation.push(opera);
198
+ return this;
199
+ };
200
+ //终结操作
201
+ /**应用加工
202
+ * @returns 自身
203
+ */
204
+ TStream.prototype.stmAppend = function () {
205
+ return __awaiter(this, void 0, Promise, function () {
206
+ var promiseList, sliceList, _loop_1, i, nlist, result, i, subList, subSize, j;
207
+ var _this = this;
208
+ return __generator(this, function (_a) {
209
+ switch (_a.label) {
210
+ case 0:
211
+ if (this._operation.length == 0)
212
+ return [2 /*return*/, this];
213
+ promiseList = [];
214
+ sliceList = this.divide(this._concurrent);
215
+ _loop_1 = function (i) {
216
+ var subList = sliceList[i];
217
+ if (!subList)
218
+ return "continue";
219
+ promiseList.push(new Promise(function (reslove) {
220
+ return __awaiter(_this, void 0, void 0, function () {
221
+ var result, _i, subList_1, item, _a, _b, operation;
222
+ return __generator(this, function (_c) {
223
+ switch (_c.label) {
224
+ case 0:
225
+ result = [];
226
+ _i = 0, subList_1 = subList;
227
+ _c.label = 1;
228
+ case 1:
229
+ if (!(_i < subList_1.length))
230
+ return [3 /*break*/, 7];
231
+ item = subList_1[_i];
232
+ if (!item)
233
+ return [3 /*break*/, 6];
234
+ _a = 0, _b = this._operation;
235
+ _c.label = 2;
236
+ case 2:
237
+ if (!(_a < _b.length))
238
+ return [3 /*break*/, 5];
239
+ operation = _b[_a];
240
+ return [4 /*yield*/, operation(item)];
241
+ case 3:
242
+ item = _c.sent();
243
+ _c.label = 4;
244
+ case 4:
245
+ _a++;
246
+ return [3 /*break*/, 2];
247
+ case 5:
248
+ result.push(item);
249
+ _c.label = 6;
250
+ case 6:
251
+ _i++;
252
+ return [3 /*break*/, 1];
253
+ case 7:
254
+ reslove(result);
255
+ return [2 /*return*/];
256
+ }
257
+ });
258
+ });
259
+ }));
260
+ };
261
+ for (i = 0; i < this._concurrent; i++) {
262
+ _loop_1(i);
263
+ }
264
+ return [4 /*yield*/, Promise.all(promiseList)];
265
+ case 1:
266
+ nlist = _a.sent();
267
+ result = new Array(this.length).fill(undefined);
268
+ for (i = 0; i < this._concurrent; i++) {
269
+ subList = nlist[i];
270
+ if (!subList)
271
+ continue;
272
+ subSize = subList.length;
273
+ for (j = 0; j < subSize; j++)
274
+ result[i + j * this._concurrent] = subList[j];
275
+ }
276
+ this.splice(0, this.length);
277
+ this.push.apply(this, result);
278
+ this._operation = [];
279
+ return [2 /*return*/, this];
280
+ }
281
+ });
282
+ });
283
+ };
284
+ return TStream;
285
+ }(Array));
286
+ __1.UtilCodec.decodeHtmlEntities('112233'); //?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/utils",
3
- "version": "1.0.206",
3
+ "version": "1.0.207",
4
4
  "description": "my utils",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,8 @@
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
19
  "@deepkit/type": "^1.0.1-alpha.153",
20
+ "@zwa73/js-utils": "^1.0.0",
21
+ "@zwa73/modular-mixer": "^1.0.2",
20
22
  "form-data": "^4.0.2",
21
23
  "glob": "^10.4.1",
22
24
  "handlebars": "^4.7.8",