ddan-js 3.4.0 → 3.4.1
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.
- package/bin/ddan-js.browser.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/ddan-js.mjs +1 -1
- package/bin/tiny/hook.d.ts +22 -14
- package/bin/tiny/utils.d.ts +20 -12
- package/bin/util/function.d.ts +10 -1
- package/bin/util/index.d.ts +9 -1
- package/package.json +1 -1
package/bin/tiny/hook.d.ts
CHANGED
|
@@ -65,6 +65,14 @@ declare const dHook: {
|
|
|
65
65
|
readonly I: T;
|
|
66
66
|
};
|
|
67
67
|
getset: <T_1 = any>(t?: T_1 | undefined) => import("..").Ddan.IGetset<T_1>;
|
|
68
|
+
singletonFactory: <T_2 extends new (...args: any[]) => any>(constructor: T_2) => {
|
|
69
|
+
new (...args: any[]): {
|
|
70
|
+
[x: string]: any;
|
|
71
|
+
};
|
|
72
|
+
__instance__: InstanceType<T_2>;
|
|
73
|
+
getInstance(): InstanceType<T_2>;
|
|
74
|
+
readonly I: InstanceType<T_2>;
|
|
75
|
+
} & T_2;
|
|
68
76
|
random: (max: number) => number;
|
|
69
77
|
randomRange: (min: number, max: number) => number;
|
|
70
78
|
lerp: (start: number, end: number, t: number) => number;
|
|
@@ -102,7 +110,7 @@ declare const dHook: {
|
|
|
102
110
|
jsonFormat: (jsonString: string) => string;
|
|
103
111
|
toLines: (content: string, separator?: string | RegExp) => string[];
|
|
104
112
|
sleep: (ms?: number) => Promise<unknown>;
|
|
105
|
-
run: <
|
|
113
|
+
run: <T_3 = any>(task?: import("..").Ddan.PFunction<T_3> | undefined, wait?: number) => Promise<[any, undefined] | [null, T_3]>;
|
|
106
114
|
exec: (func: import("..").Ddan.Function, taskId?: string) => import("..").Ddan.PSafeResult<any>;
|
|
107
115
|
debounce: typeof import("../modules/hook/modules/debounce").default;
|
|
108
116
|
throttle: typeof import("../modules/hook/modules/throttle").default;
|
|
@@ -113,10 +121,10 @@ declare const dHook: {
|
|
|
113
121
|
pipeline: (max?: number) => import("../modules/hook/modules/pipeline").default;
|
|
114
122
|
safeTask: (func: import("..").Ddan.Function, callback?: ((result: import("..").Ddan.SafeResult<any>) => void) | undefined) => import("../modules/hook/modules/safeTask").default;
|
|
115
123
|
pipeAsync: (func: import("..").Ddan.Function) => import("..").Ddan.PSafeResult<any>;
|
|
116
|
-
runAsync: <
|
|
124
|
+
runAsync: <T_4 = any>(func: any, opts?: {
|
|
117
125
|
pipe?: boolean | undefined;
|
|
118
126
|
mutex?: string | undefined;
|
|
119
|
-
}) => Promise<
|
|
127
|
+
}) => Promise<T_4 | undefined>;
|
|
120
128
|
anySuccess: (promises: Promise<any>[]) => Promise<boolean>;
|
|
121
129
|
bezier1: (p0: import("..").Ddan.IPoint, p1: import("..").Ddan.IPoint, t: number) => import("..").Ddan.IPoint;
|
|
122
130
|
bezier2: (p0: import("..").Ddan.IPoint, p1: import("..").Ddan.IPoint, p2: import("..").Ddan.IPoint, t: number) => import("..").Ddan.IPoint;
|
|
@@ -129,14 +137,14 @@ declare const dHook: {
|
|
|
129
137
|
logParse: (logStr: string) => string;
|
|
130
138
|
logRString: (data: any) => Promise<string>;
|
|
131
139
|
logRParse: (logStr: string) => Promise<string>;
|
|
132
|
-
to: <
|
|
133
|
-
go: <
|
|
140
|
+
to: <T_5 = any, U extends object = any>(promise: Promise<T_5>, errorExt?: object | undefined, fn?: import("..").Ddan.noop | undefined) => Promise<[null, T_5] | [U, undefined]>;
|
|
141
|
+
go: <T_6 = any>(task?: import("..").Ddan.PFunction<T_6> | undefined, fn?: import("..").Ddan.noop | undefined) => Promise<[any, undefined] | [null, T_6]>;
|
|
134
142
|
delay: (ms?: number) => Promise<unknown>;
|
|
135
|
-
safeRun: <
|
|
143
|
+
safeRun: <T_7 = any>(func: any, fn?: import("..").Ddan.noop | undefined) => Promise<[any, undefined] | [null, T_7]>;
|
|
136
144
|
toError: (value: any) => any;
|
|
137
|
-
timeout: <
|
|
138
|
-
getValueIf: <
|
|
139
|
-
resolveValue: <
|
|
145
|
+
timeout: <T_8 = any>(task?: import("..").Ddan.PFunction<T_8> | undefined, ms?: number, desc?: string) => Promise<[any, undefined] | [null, T_8]>;
|
|
146
|
+
getValueIf: <T_9 = any, F = any>(condition: boolean | (() => boolean), trueValue: T_9 | (() => T_9), falseValue?: F | (() => F) | undefined) => T_9 | F | undefined;
|
|
147
|
+
resolveValue: <T_10 = any>(value: T_10 | (() => T_10)) => T_10;
|
|
140
148
|
base64: {
|
|
141
149
|
encode: (input: string) => string;
|
|
142
150
|
decode: (base64Str: string) => string;
|
|
@@ -192,7 +200,7 @@ declare const dHook: {
|
|
|
192
200
|
bytes2hex: (bytes: Uint8Array) => string;
|
|
193
201
|
toUint32: (str: string) => Uint32Array;
|
|
194
202
|
fromUint32: (uint32: Uint32Array) => string;
|
|
195
|
-
flatten: <
|
|
203
|
+
flatten: <T_11>(data: T_11[], recursive?: boolean, list?: T_11[]) => T_11[];
|
|
196
204
|
flattenPath: (data: Record<string, any>) => Record<string, any>;
|
|
197
205
|
normalizeStructure: (data: any, prevData: any) => void;
|
|
198
206
|
diffPath: (data: Record<string, any>, prevData: Record<string, any>) => Record<string, any>;
|
|
@@ -208,12 +216,12 @@ declare const dHook: {
|
|
|
208
216
|
ignoreEmptyString?: boolean | undefined;
|
|
209
217
|
}) => any;
|
|
210
218
|
clone: (source: any, weakMap?: WeakMap<object, any>) => any;
|
|
211
|
-
cloneClass: <
|
|
212
|
-
isEqual: <
|
|
219
|
+
cloneClass: <T_12>(source: T_12) => T_12;
|
|
220
|
+
isEqual: <T_13 = any>(value: T_13, other: T_13, depth?: number) => boolean;
|
|
213
221
|
isEqualArray: (value: any[], other: any[], depth?: number) => boolean;
|
|
214
222
|
isEqualObject: (value: Record<string, any>, other: Record<string, any>, depth?: number) => boolean;
|
|
215
|
-
isEqualValue: <
|
|
223
|
+
isEqualValue: <T_14>(value: T_14, other: T_14, type: string) => boolean;
|
|
216
224
|
isEqualAB: (value: ArrayBuffer, other: ArrayBuffer) => boolean;
|
|
217
|
-
isEqualDeep: <
|
|
225
|
+
isEqualDeep: <T_15>(value: T_15, other: T_15) => boolean;
|
|
218
226
|
};
|
|
219
227
|
export default dHook;
|
package/bin/tiny/utils.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ declare const dUtil: {
|
|
|
10
10
|
readonly I: T;
|
|
11
11
|
};
|
|
12
12
|
getset: <T_1 = any>(t?: T_1 | undefined) => import("..").Ddan.IGetset<T_1>;
|
|
13
|
+
singletonFactory: <T_2 extends new (...args: any[]) => any>(constructor: T_2) => {
|
|
14
|
+
new (...args: any[]): {
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
};
|
|
17
|
+
__instance__: InstanceType<T_2>;
|
|
18
|
+
getInstance(): InstanceType<T_2>;
|
|
19
|
+
readonly I: InstanceType<T_2>;
|
|
20
|
+
} & T_2;
|
|
13
21
|
copy: (source: any, options?: {
|
|
14
22
|
fields?: string[] | undefined;
|
|
15
23
|
camel?: boolean | undefined;
|
|
@@ -22,7 +30,7 @@ declare const dUtil: {
|
|
|
22
30
|
number?: boolean | undefined;
|
|
23
31
|
boolean?: boolean | undefined;
|
|
24
32
|
}) => any;
|
|
25
|
-
cloneClass: <
|
|
33
|
+
cloneClass: <T_3>(source: T_3) => T_3;
|
|
26
34
|
combine: (target: any, source: any, options?: import("..").Ddan.IIgnoreParams) => any;
|
|
27
35
|
combines: (objs: any[], options?: import("..").Ddan.IIgnoreParams) => {};
|
|
28
36
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
@@ -108,7 +116,7 @@ declare const dUtil: {
|
|
|
108
116
|
bytes2hex: (bytes: Uint8Array) => string;
|
|
109
117
|
toUint32: (str: string) => Uint32Array;
|
|
110
118
|
fromUint32: (uint32: Uint32Array) => string;
|
|
111
|
-
flatten: <
|
|
119
|
+
flatten: <T_4>(data: T_4[], recursive?: boolean, list?: T_4[]) => T_4[];
|
|
112
120
|
gbk: {
|
|
113
121
|
gbkLength: (str: string) => number;
|
|
114
122
|
gbkCut: (source: string, len: number) => string;
|
|
@@ -135,16 +143,16 @@ declare const dUtil: {
|
|
|
135
143
|
};
|
|
136
144
|
};
|
|
137
145
|
list: {
|
|
138
|
-
stepAction: <
|
|
139
|
-
skip: <
|
|
140
|
-
take: <
|
|
141
|
-
distinct: <
|
|
142
|
-
randoms: <
|
|
146
|
+
stepAction: <T_5>(list: T_5[], func: import("..").Ddan.Task<T_5, void>, stepCount?: number) => void;
|
|
147
|
+
skip: <T_6>(list: T_6[], count: number) => T_6[];
|
|
148
|
+
take: <T_7>(list: T_7[], count: number, skip?: number) => T_7[];
|
|
149
|
+
distinct: <T_8>(list: T_8[]) => T_8[];
|
|
150
|
+
randoms: <T_9>(list: T_9[], count?: number, repeat?: boolean) => T_9[];
|
|
143
151
|
toKV: (list: import("..").Ddan.KV<any>[], key: string, value: string) => import("..").Ddan.KV<any>;
|
|
144
|
-
groupBy: <
|
|
145
|
-
first: <
|
|
146
|
-
last: <
|
|
147
|
-
toList: <
|
|
152
|
+
groupBy: <T_10>(list: T_10[], key: string) => Record<string, T_10[]>;
|
|
153
|
+
first: <T_11>(list: T_11[]) => T_11 | undefined;
|
|
154
|
+
last: <T_12>(list: T_12[]) => T_12 | undefined;
|
|
155
|
+
toList: <T_13>(val: T_13 | T_13[]) => T_13[];
|
|
148
156
|
};
|
|
149
157
|
string: {
|
|
150
158
|
toString: (value: any) => any;
|
|
@@ -206,7 +214,7 @@ declare const dUtil: {
|
|
|
206
214
|
number?: boolean | undefined;
|
|
207
215
|
boolean?: boolean | undefined;
|
|
208
216
|
}) => any;
|
|
209
|
-
cloneClass: <
|
|
217
|
+
cloneClass: <T_3>(source: T_3) => T_3;
|
|
210
218
|
combine: (target: any, source: any, options?: import("..").Ddan.IIgnoreParams) => any;
|
|
211
219
|
combines: (objs: any[], options?: import("..").Ddan.IIgnoreParams) => {};
|
|
212
220
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
package/bin/util/function.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ddan } from
|
|
1
|
+
import { Ddan } from '../typings';
|
|
2
2
|
/**
|
|
3
3
|
* 设置单例模式
|
|
4
4
|
* @returns
|
|
@@ -9,9 +9,18 @@ declare function singleton<T>(): {
|
|
|
9
9
|
readonly Instance: T;
|
|
10
10
|
readonly I: T;
|
|
11
11
|
};
|
|
12
|
+
declare function singletonFactory<T extends new (...args: any[]) => any>(constructor: T): {
|
|
13
|
+
new (...args: any[]): {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
};
|
|
16
|
+
__instance__: InstanceType<T>;
|
|
17
|
+
getInstance(): InstanceType<T>;
|
|
18
|
+
readonly I: InstanceType<T>;
|
|
19
|
+
} & T;
|
|
12
20
|
declare function getset<T = any>(t?: T): Ddan.IGetset<T>;
|
|
13
21
|
declare const _default: {
|
|
14
22
|
singleton: typeof singleton;
|
|
15
23
|
getset: typeof getset;
|
|
24
|
+
singletonFactory: typeof singletonFactory;
|
|
16
25
|
};
|
|
17
26
|
export default _default;
|
package/bin/util/index.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ declare const _default: {
|
|
|
9
9
|
readonly I: T;
|
|
10
10
|
};
|
|
11
11
|
getset: <T_1 = any>(t?: T_1 | undefined) => import("..").Ddan.IGetset<T_1>;
|
|
12
|
+
singletonFactory: <T_2 extends new (...args: any[]) => any>(constructor: T_2) => {
|
|
13
|
+
new (...args: any[]): {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
};
|
|
16
|
+
__instance__: InstanceType<T_2>;
|
|
17
|
+
getInstance(): InstanceType<T_2>;
|
|
18
|
+
readonly I: InstanceType<T_2>;
|
|
19
|
+
} & T_2;
|
|
12
20
|
copy: (source: any, options?: {
|
|
13
21
|
fields?: string[] | undefined;
|
|
14
22
|
camel?: boolean | undefined;
|
|
@@ -21,7 +29,7 @@ declare const _default: {
|
|
|
21
29
|
number?: boolean | undefined;
|
|
22
30
|
boolean?: boolean | undefined;
|
|
23
31
|
}) => any;
|
|
24
|
-
cloneClass: <
|
|
32
|
+
cloneClass: <T_3>(source: T_3) => T_3;
|
|
25
33
|
combine: (target: any, source: any, options?: import("..").Ddan.IIgnoreParams) => any;
|
|
26
34
|
combines: (objs: any[], options?: import("..").Ddan.IIgnoreParams) => {};
|
|
27
35
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|