@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
@@ -1,4 +1,3 @@
1
1
  import { UtilFT } from "./UtilFileTools";
2
- import { UtilFunc } from "./UtilFunctions";
3
- export declare const outcome: typeof UtilFunc.outcome, matchProc: typeof UtilFunc.matchProc, sucesProc: typeof UtilFunc.sucesProc, isFailed: typeof UtilFunc.isFailed, isSafeNumber: typeof UtilFunc.isSafeNumber, isSuccess: typeof UtilFunc.isSuccess, likeNone: typeof UtilFunc.likeNone, expect: typeof UtilFunc.expect, assertType: typeof UtilFunc.assertType, assertLiteral: typeof UtilFunc.assertLiteral, deepClone: typeof UtilFunc.deepClone, sleep: typeof UtilFunc.sleep, stringifyJToken: typeof UtilFunc.stringifyJToken, getTime: typeof UtilFunc.getTime, mapEntries: typeof UtilFunc.mapEntries, dedent: typeof UtilFunc.dedent, throwError: typeof UtilFunc.throwError, eitherize: typeof UtilFunc.eitherize, taskEitherize: typeof UtilFunc.taskEitherize, memoize: typeof UtilFunc.memoize, ivk: typeof UtilFunc.ivk, l2s: typeof UtilFunc.l2s, s2l: typeof UtilFunc.s2l;
2
+ export declare const outcome: typeof import("@zwa73/js-utils").JsFunc.outcome, matchProc: typeof import("@zwa73/js-utils").JsFunc.matchProc, sucesProc: typeof import("@zwa73/js-utils").JsFunc.sucesProc, isFailed: typeof import("@zwa73/js-utils").JsFunc.isFailed, isSafeNumber: typeof import("@zwa73/js-utils").JsFunc.isSafeNumber, isSuccess: typeof import("@zwa73/js-utils").JsFunc.isSuccess, likeNone: typeof import("@zwa73/js-utils").JsFunc.likeNone, expect: typeof import("@zwa73/js-utils").JsFunc.expect, assertType: typeof import("@zwa73/js-utils").JsFunc.assertType, assertLiteral: typeof import("@zwa73/js-utils").JsFunc.assertLiteral, deepClone: typeof import("@zwa73/js-utils").JsFunc.deepClone, sleep: typeof import("@zwa73/js-utils").JsFunc.sleep, stringifyJToken: typeof import("@zwa73/js-utils").JsFunc.stringifyJToken, getTime: typeof import("@zwa73/js-utils").JsFunc.getTime, mapEntries: typeof import("@zwa73/js-utils").JsFunc.mapEntries, dedent: typeof import("@zwa73/js-utils").JsFunc.dedent, throwError: typeof import("@zwa73/js-utils").JsFunc.throwError, eitherize: typeof import("@zwa73/js-utils").JsFunc.eitherize, taskEitherize: typeof import("@zwa73/js-utils").JsFunc.taskEitherize, memoize: typeof import("@zwa73/js-utils").JsFunc.memoize, ivk: typeof import("@zwa73/js-utils").JsFunc.ivk, l2s: typeof import("@zwa73/js-utils").JsFunc.l2s, s2l: typeof import("@zwa73/js-utils").JsFunc.s2l;
4
3
  export declare const stylizePath: typeof UtilFT.stylizePath, posixizePath: typeof UtilFT.posixizePath, win32izePath: typeof UtilFT.win32izePath, currosizePath: typeof UtilFT.currosizePath;
@@ -3,29 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.currosizePath = exports.win32izePath = exports.posixizePath = exports.stylizePath = exports.s2l = exports.l2s = exports.ivk = exports.memoize = exports.taskEitherize = exports.eitherize = exports.throwError = exports.dedent = exports.mapEntries = exports.getTime = exports.stringifyJToken = exports.sleep = exports.deepClone = exports.assertLiteral = exports.assertType = exports.expect = exports.likeNone = exports.isSuccess = exports.isSafeNumber = exports.isFailed = exports.sucesProc = exports.matchProc = exports.outcome = void 0;
4
4
  const UtilFileTools_1 = require("./UtilFileTools");
5
5
  const UtilFunctions_1 = require("./UtilFunctions");
6
- const UtilSymbol_1 = require("./UtilSymbol");
7
6
  exports.outcome = UtilFunctions_1.UtilFunc.outcome, exports.matchProc = UtilFunctions_1.UtilFunc.matchProc, exports.sucesProc = UtilFunctions_1.UtilFunc.sucesProc, exports.isFailed = UtilFunctions_1.UtilFunc.isFailed, exports.isSafeNumber = UtilFunctions_1.UtilFunc.isSafeNumber, exports.isSuccess = UtilFunctions_1.UtilFunc.isSuccess, exports.likeNone = UtilFunctions_1.UtilFunc.likeNone, exports.expect = UtilFunctions_1.UtilFunc.expect, exports.assertType = UtilFunctions_1.UtilFunc.assertType, exports.assertLiteral = UtilFunctions_1.UtilFunc.assertLiteral, exports.deepClone = UtilFunctions_1.UtilFunc.deepClone, exports.sleep = UtilFunctions_1.UtilFunc.sleep, exports.stringifyJToken = UtilFunctions_1.UtilFunc.stringifyJToken, exports.getTime = UtilFunctions_1.UtilFunc.getTime, exports.mapEntries = UtilFunctions_1.UtilFunc.mapEntries, exports.dedent = UtilFunctions_1.UtilFunc.dedent, exports.throwError = UtilFunctions_1.UtilFunc.throwError, exports.eitherize = UtilFunctions_1.UtilFunc.eitherize, exports.taskEitherize = UtilFunctions_1.UtilFunc.taskEitherize, exports.memoize = UtilFunctions_1.UtilFunc.memoize, exports.ivk = UtilFunctions_1.UtilFunc.ivk, exports.l2s = UtilFunctions_1.UtilFunc.l2s, exports.s2l = UtilFunctions_1.UtilFunc.s2l;
8
7
  exports.stylizePath = UtilFileTools_1.UtilFT.stylizePath, exports.posixizePath = UtilFileTools_1.UtilFT.posixizePath, exports.win32izePath = UtilFileTools_1.UtilFT.win32izePath, exports.currosizePath = UtilFileTools_1.UtilFT.currosizePath;
9
8
  if (false) {
10
- let aaser = (0, exports.assertLiteral)({ a: 1 });
11
- let a = null;
12
- const r = (0, exports.matchProc)(a, {
13
- "asd": (a) => "ssa",
14
- "dsa": (b) => "ssb",
15
- });
16
- let b = null;
17
- const r1 = (0, exports.matchProc)(b, {
18
- "a": (a, s) => "ssa",
19
- [UtilSymbol_1.None]: (b, s) => "ssb",
20
- });
21
- let udt = (0, exports.outcome)("ssa", "None");
22
- let assa = (0, exports.isFailed)(null);
23
- let assb = (0, exports.isFailed)(null);
24
- let assc = (0, exports.isFailed)(null);
25
- let asssc = (0, exports.isFailed)(null);
26
- let assa1 = (0, exports.isFailed)(null);
27
- let assb1 = (0, exports.isFailed)(null);
28
- let assc1 = (0, exports.isFailed)(null);
29
- let proct = (0, exports.sucesProc)(null, (s) => "ssa", (f) => "ssad", () => 123);
30
- let matt = (0, exports.matchProc)(null, {});
9
+ //let aaser = assertLiteral({a:1});
10
+ //let a:"asd"|"dsa" = null as any;
11
+ //const r = matchProc(a,{
12
+ // "asd":(a)=>"ssa" as const,
13
+ // "dsa":(b)=>"ssb" as const,
14
+ //});
15
+ //let b:Outcome<"a","123">|NoneOut = null as any;
16
+ //const r1 = matchProc(b,{
17
+ // "a":(a,s)=>"ssa" as const,
18
+ // [None]:(b,s)=>"ssb" as const,
19
+ //});
20
+ //let udt = outcome("ssa","None");
21
+ //type test = Outcome<"a"|"b",any> extends Outcome<"a",12>|Outcome<"b",34>
22
+ // ? "suc" : "fal"
23
+ //let assa = isFailed(null as any as Failed);
24
+ //let assb = isFailed(null as any as Failed|Success);
25
+ //let assc = isFailed(null as any as Success);
26
+ //let asssc = isFailed(null);
27
+ //let assa1 = isFailed(null as any as Outcome<Failed,unknown>);
28
+ //let assb1 = isFailed(null as any as Outcome<Failed|Success,unknown>);
29
+ //let assc1 = isFailed(null as any as Outcome<Success,unknown>);
30
+ //let proct = sucesProc(null as any as Outcome<Failed|Success,"123">|Outcome<Failed,"1234">|Outcome<Success,"1s23">,
31
+ // (s)=>"ssa" as const,
32
+ // (f)=>"ssad" as const,
33
+ // ()=>123 as const);
34
+ //let matt = matchProc(null as any as Outcome<symbol,123>,{
35
+ //});
31
36
  }
@@ -1,98 +1 @@
1
- import { Keyable, Literal, MPromise } from "./UtilInterfaces";
2
- import Handlebars from 'handlebars';
3
- /**函数管道器 */
4
- export declare class Piper<Arg, Result = Arg> {
5
- /**管道函数列表 */
6
- private funcs;
7
- private constructor();
8
- /**添加单个参数与返回值不同的函数 */
9
- static pipe<Arg, Result>(func: (arg: Arg) => Result): Piper<Arg, Result>;
10
- /**添加多个参数与返回值相同的函数 */
11
- static pipe<Arg>(func: ((arg: Arg) => Arg), ...funcs: ((arg: Arg) => Arg)[]): Piper<Arg>;
12
- /**添加单个参数与返回值不同的函数 */
13
- pipe<T>(func: (arg: Result) => T): Piper<Arg, T>;
14
- /**添加多个参数与返回值相同的函数 */
15
- pipe(func: ((arg: Result) => Result), ...funcs: ((arg: Result) => Result)[]): Piper<Arg, Result>;
16
- /**管道函数 */
17
- pipeline(): (arg: Arg) => Result;
18
- /**直接调用 */
19
- invoke(arg: Arg): Result;
20
- }
21
- type StreamOperation<T, U> = (item: T) => MPromise<U>;
22
- /**并行流 */
23
- export declare class Stream<T> implements Iterable<T> {
24
- /**并发数*/
25
- private _concurrent;
26
- private _list;
27
- /**加工函数列表*/
28
- private _operation;
29
- private constructor();
30
- /**从arraylike创建流
31
- * @param args - arraylike
32
- * @param concurrent - 并发数 默认 1
33
- */
34
- static from<T>(args: ArrayLike<T>, concurrent?: number): Stream<T>;
35
- /**从数组创建流 */
36
- static of<T>(...args: T[]): Stream<T>;
37
- /**设置并发数 */
38
- concurrent(count: number): Stream<T>;
39
- /**平分数组
40
- * @param count - 份数
41
- * @param mode - 模式 average:轮询平均分 chunk:切块均分
42
- * @returns 新数组
43
- */
44
- private divide;
45
- /**转换流
46
- * @param operation - 加工函数
47
- * @returns 新流
48
- */
49
- private trans;
50
- /**流式的 映射加工
51
- * @param operation - 加工函数
52
- * @returns 新流
53
- */
54
- map<U>(operation: StreamOperation<T, U>): Stream<U>;
55
- /**流式的 遍历
56
- * 返回自身
57
- * @param operation - 遍历函数
58
- * @returns 自身
59
- */
60
- each(operation: StreamOperation<T, void>): Stream<T>;
61
- /**应用加工
62
- * @returns 自身
63
- */
64
- append(): Promise<Stream<T>>;
65
- /**应用加工 并转换为数组
66
- * @returns 数组
67
- */
68
- toArray(): Promise<Array<T>>;
69
- /**应用加工 并排除某个字面量
70
- * @param value - 排除的值
71
- * @returns 自身
72
- */
73
- exclude<E>(value: Literal<E>): Promise<Stream<Exclude<T, E>>>;
74
- /**应用加工 并过滤
75
- * @param func - 过滤函数
76
- * @returns 自身
77
- */
78
- filter(func: (value: T, index: number, array: T[]) => boolean): Promise<Stream<T>>;
79
- [Symbol.iterator](): Iterator<T>;
80
- get length(): number;
81
- }
82
- /**文本模板渲染器
83
- * @template T - 上下文对象的类型,默认为记录类型
84
- */
85
- export declare class Hbs<T extends Record<Keyable, any> = Record<Keyable, any>> {
86
- hbs: typeof Handlebars;
87
- context: T;
88
- /**创建一个新的 Hbs 实例
89
- * @param context - 上下文对象,用于在渲染模板时提供数据
90
- */
91
- constructor(context?: T);
92
- /**渲染模板
93
- * @param template - 要渲染的 Handlebars 模板字符串
94
- * @returns 渲染后的字符串
95
- */
96
- render(template: string): string;
97
- }
98
- export {};
1
+ export { Piper, Stream, Hbs } from "@zwa73/js-utils";
package/dist/UtilClass.js CHANGED
@@ -1,246 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Hbs = exports.Stream = exports.Piper = void 0;
7
- const QuickExport_1 = require("./QuickExport");
8
- const handlebars_1 = __importDefault(require("handlebars"));
9
- const UtilLogger_1 = require("./UtilLogger");
10
- /**函数管道器 */
11
- class Piper {
12
- /**管道函数列表 */
13
- funcs = [];
14
- constructor() { }
15
- ;
16
- static pipe(...funcs) {
17
- const newPiper = new Piper();
18
- newPiper.funcs = [...funcs];
19
- return newPiper;
20
- }
21
- pipe(...funcs) {
22
- const newPiper = new Piper();
23
- newPiper.funcs = [...this.funcs, ...funcs];
24
- return newPiper;
25
- }
26
- /**管道函数 */
27
- pipeline() {
28
- return (arg) => this.funcs.reduce((value, func) => func(value), arg);
29
- }
30
- /**直接调用 */
31
- invoke(arg) {
32
- return this.funcs.reduce((value, func) => func(value), arg);
33
- }
34
- }
35
- exports.Piper = Piper;
36
- /**并行流 */
37
- class Stream {
38
- /**并发数*/
39
- _concurrent;
40
- _list;
41
- /**加工函数列表*/
42
- _operation = [];
43
- constructor(base, concurrent = 1) {
44
- if (base == undefined)
45
- this._list = new Array();
46
- else if (typeof base === 'number')
47
- this._list = new Array(base);
48
- else
49
- this._list = new Array(...base);
50
- this._concurrent = concurrent;
51
- }
52
- /**从arraylike创建流
53
- * @param args - arraylike
54
- * @param concurrent - 并发数 默认 1
55
- */
56
- static from(args, concurrent = 1) {
57
- return new Stream(Array.from(args), concurrent);
58
- }
59
- /**从数组创建流 */
60
- static of(...args) {
61
- return new Stream(args);
62
- }
63
- /**设置并发数 */
64
- concurrent(count) {
65
- this._concurrent = count;
66
- return this;
67
- }
68
- /**平分数组
69
- * @param count - 份数
70
- * @param mode - 模式 average:轮询平均分 chunk:切块均分
71
- * @returns 新数组
72
- */
73
- divide(count, mode = "average") {
74
- if (count <= 0)
75
- return [];
76
- if (count == 1)
77
- return [[...this]];
78
- const size = this.length;
79
- const result = [];
80
- (0, QuickExport_1.matchProc)(mode, {
81
- //轮询平均分
82
- 'average': () => {
83
- for (let i = 0; i < count; i++) {
84
- const clist = [];
85
- for (let j = i; j < size; j += count)
86
- clist.push(this._list[j]);
87
- result.push(clist);
88
- }
89
- },
90
- //切块均分
91
- 'chunk': () => {
92
- const chunkSize = Math.ceil(size / count);
93
- for (let i = 0; i < count; i++) {
94
- const start = i * chunkSize;
95
- let end = (i + 1) * chunkSize;
96
- if (end > size)
97
- end = size;
98
- result.push(this._list.slice(start, end));
99
- }
100
- },
101
- });
102
- return result;
103
- }
104
- /**转换流
105
- * @param operation - 加工函数
106
- * @returns 新流
107
- */
108
- trans(operation) {
109
- const ns = new Stream(this._list, this._concurrent);
110
- ns._operation.push(...this._operation);
111
- ns._operation.push(operation);
112
- return ns;
113
- }
114
- /**流式的 映射加工
115
- * @param operation - 加工函数
116
- * @returns 新流
117
- */
118
- map(operation) {
119
- return this.trans(operation);
120
- }
121
- /**流式的 遍历
122
- * 返回自身
123
- * @param operation - 遍历函数
124
- * @returns 自身
125
- */
126
- each(operation) {
127
- const opera = async (item) => {
128
- await operation(item);
129
- return item;
130
- };
131
- return this.trans(opera);
132
- ;
133
- }
134
- //终结操作
135
- /**应用加工
136
- * @returns 自身
137
- */
138
- async append() {
139
- if (this._operation.length == 0)
140
- return this;
141
- //均分处理
142
- const pList = this.divide(this._concurrent)
143
- .map(async (subList) => {
144
- const result = [];
145
- for (let item of subList) {
146
- for (const operation of this._operation)
147
- item = await operation(item);
148
- result.push(item);
149
- }
150
- return (result);
151
- });
152
- const rlist = await Promise.all(pList);
153
- //拼接结果 轮询均分
154
- const result = new Array(this.length).fill(undefined);
155
- rlist.forEach((subList, i) => {
156
- if (!subList)
157
- return;
158
- const subSize = subList.length;
159
- for (let j = 0; j < subSize; j++)
160
- result[i + j * this._concurrent] = subList[j];
161
- });
162
- this._list = result;
163
- this._operation = [];
164
- return this;
165
- }
166
- /**应用加工 并转换为数组
167
- * @returns 数组
168
- */
169
- async toArray() {
170
- await this.append();
171
- return [...this];
172
- }
173
- /**应用加工 并排除某个字面量
174
- * @param value - 排除的值
175
- * @returns 自身
176
- */
177
- async exclude(value) {
178
- await this.append();
179
- return new Stream(this._list.filter((v) => v !== value));
180
- }
181
- /**应用加工 并过滤
182
- * @param func - 过滤函数
183
- * @returns 自身
184
- */
185
- async filter(func) {
186
- await this.append();
187
- return new Stream(this._list.filter(func));
188
- }
189
- //迭代器
190
- [Symbol.iterator]() {
191
- let index = 0;
192
- const data = this._list;
193
- return {
194
- next: () => ({
195
- value: data[index++],
196
- done: index > data.length
197
- })
198
- };
199
- }
200
- // 创建 length 属性的 getter 和 setter
201
- get length() {
202
- return this._list.length;
203
- }
204
- }
205
- exports.Stream = Stream;
4
+ //#region UtilClass转导
5
+ var js_utils_1 = require("@zwa73/js-utils");
6
+ Object.defineProperty(exports, "Piper", { enumerable: true, get: function () { return js_utils_1.Piper; } });
7
+ Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return js_utils_1.Stream; } });
8
+ Object.defineProperty(exports, "Hbs", { enumerable: true, get: function () { return js_utils_1.Hbs; } });
206
9
  //#endregion
207
- /**文本模板渲染器
208
- * @template T - 上下文对象的类型,默认为记录类型
209
- */
210
- class Hbs {
211
- hbs = handlebars_1.default.create();
212
- context;
213
- /**创建一个新的 Hbs 实例
214
- * @param context - 上下文对象,用于在渲染模板时提供数据
215
- */
216
- constructor(context = {}) {
217
- this.context = context;
218
- this.hbs.registerHelper('def', (name, options) => {
219
- const value = options.fn(this.context).trim();
220
- this.context[name] = value;
221
- return '';
222
- });
223
- this.hbs.registerHelper('defli', (name, options) => {
224
- const rawvalue = options.fn(this.context);
225
- const values = rawvalue
226
- .split('[[br]]')
227
- .map(value => value.trim());
228
- this.context[name] = values;
229
- return '';
230
- });
231
- }
232
- /**渲染模板
233
- * @param template - 要渲染的 Handlebars 模板字符串
234
- * @returns 渲染后的字符串
235
- */
236
- render(template) {
237
- try {
238
- return this.hbs.compile(template)(this.context);
239
- }
240
- catch (e) {
241
- UtilLogger_1.SLogger.error(e);
242
- return '';
243
- }
244
- }
245
- }
246
- exports.Hbs = Hbs;
package/dist/UtilCom.d.ts CHANGED
@@ -216,7 +216,7 @@ export declare class UtilCom<D extends Partial<RequestOption> & Required<Pick<Re
216
216
  option: PartialOption<RequestOption, D>;
217
217
  verify?: StatusVerifyFn<ParseResult<A>>;
218
218
  retries?: PromiseRetries;
219
- }, ...datas: SendParams<S>): Promise<import("./UtilFunctions").PromiseRetryResult<ParseResult<A>>>;
219
+ }, ...datas: SendParams<S>): Promise<import("@zwa73/js-utils").PromiseRetryResult<ParseResult<A>>>;
220
220
  /**发送网络请求
221
221
  * @param option - 网络请求选项
222
222
  * @param proc - 请求处理函数 需调用req.end()
@@ -1,32 +1 @@
1
- import { NeedInit } from "./UtilInterfaces";
2
- type TDTg<T> = (target: Object, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
3
- type DTg = (target: Object, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
4
- /**用于打印方法运行时间
5
- * @param flag - 时间标签
6
- * @param suffixUID - 是否尾随uid
7
- */
8
- export declare function LogTime(flag: string, suffixUID?: boolean): DTg;
9
- /**用于打印异步方法运行时间
10
- * @param flag - 时间标签
11
- * @param suffixUID - 是否尾随uid
12
- */
13
- export declare function LogTimeAsync(flag: string, suffixUID?: boolean): DTg;
14
- /**用于打印方法的调用 */
15
- export declare function LogCall(): DTg;
16
- /**用于打印异步方法的调用 */
17
- export declare function LogCallAsync(): DTg;
18
- /**用于打印方法的调用 */
19
- export declare function LogErr(): DTg;
20
- /**用于打印异步方法的调用 */
21
- export declare function LogErrAsync(): DTg;
22
- /**try-finally包装 */
23
- export declare function Defer<T extends (...args: any) => any>(deferLogic: (...args: Parameters<T>) => any): TDTg<T>;
24
- /**异步的try-finally包装 */
25
- export declare function DeferAsync<T extends (...args: any) => Promise<any>>(deferLogic: (...args: Parameters<T>) => any | Promise<any>): TDTg<T>;
26
- /**try-catch包装 */
27
- export declare function Catch<T extends (...args: any) => any>(catchLogic: (error: any, ...args: Parameters<T>) => ReturnType<T>): TDTg<T>;
28
- /**异步的try-catch包装 */
29
- export declare function CatchAsync<T extends (...args: any) => Promise<any>>(catchLogic: (error: any, ...args: Parameters<T>) => ReturnType<T>): TDTg<T>;
30
- /**等待完成init */
31
- export declare function AwaitInited<T extends NeedInit>(target: T, propertyKey: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>): TypedPropertyDescriptor<(...args: any[]) => Promise<any>>;
32
- export {};
1
+ export { ParamsDecoratorsGener, BaseDecoratorsGener, LogTime, LogTimeAsync, LogCall, LogCallAsync, LogErr, LogErrAsync, Defer, DeferAsync, Catch, CatchAsync, AwaitInited } from "@zwa73/js-utils";