ddan-js 2.10.2 → 2.10.4

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/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import Store from './class/store';
5
5
  import Persist from './class/persist';
6
6
  import KValue from './class/kvalue';
7
7
  import Mapping from './class/mapping';
8
+ import dHook from './tiny/hook';
8
9
  declare const dUtil: {
9
10
  Event: typeof Event;
10
11
  includes: typeof import("./util/includes").default;
@@ -236,206 +237,6 @@ declare const dUtil: {
236
237
  };
237
238
  };
238
239
  };
239
- declare const dHook: {
240
- qs: {
241
- parse: (qs: any, { sep, eq, max, multiple, uri, parseNumber, parseBoolean }?: {
242
- sep?: string | undefined;
243
- eq?: string | undefined;
244
- max?: number | undefined;
245
- multiple?: boolean | undefined;
246
- uri?: boolean | undefined;
247
- parseNumber?: boolean | undefined;
248
- parseBoolean?: boolean | undefined;
249
- }) => {};
250
- stringify: (obj: any, { sep, eq, name, uri, cleanZero, cleanNull, cleanWhitespace }?: {
251
- sep?: string | undefined;
252
- eq?: string | undefined;
253
- name?: null | undefined;
254
- uri?: boolean | undefined;
255
- cleanZero?: boolean | undefined;
256
- cleanNull?: boolean | undefined;
257
- cleanWhitespace?: boolean | undefined;
258
- }) => string;
259
- https: (url: string) => string;
260
- parseUrl: (url: string) => {
261
- pathname: string;
262
- params: {};
263
- route: string;
264
- page: string;
265
- name: string;
266
- withoutExtension: string;
267
- extname: string;
268
- href: string;
269
- url: string;
270
- origin: string;
271
- host: string;
272
- protocol: string;
273
- port: string;
274
- query: string;
275
- };
276
- parsePath: (url: string) => {
277
- route: string;
278
- page: string;
279
- name: string;
280
- withoutExtension: string;
281
- extname: string;
282
- };
283
- parseHost: (url: string) => import("./typings").Ddan.IHttpHost;
284
- join: (...args: string[]) => string;
285
- shExpMatch: (text: string, pattern: string) => boolean;
286
- isLocalIpAddress: (addr: string) => boolean;
287
- parseFileUrl: (url: string) => {
288
- href: string;
289
- file: string;
290
- url: string;
291
- protocol: string;
292
- host: string;
293
- query: string;
294
- params: {};
295
- };
296
- };
297
- singleton: <T>() => {
298
- new (): {};
299
- __instance__: any;
300
- readonly Instance: T;
301
- readonly I: T;
302
- };
303
- random: (max: number) => number;
304
- randomRange: (min: number, max: number) => number;
305
- lerp: (start: number, end: number, t: number) => number;
306
- randoms: (max: number, count?: number, repeat?: boolean) => number[];
307
- strip: (num: string | number, digits?: number) => number;
308
- float: (num: string | number, { digits, fixed }?: {
309
- digits?: number | undefined;
310
- fixed?: boolean | undefined;
311
- }) => number;
312
- radian2degree: (radians: number) => number;
313
- degree2radian: (degrees: number) => number;
314
- calcDataSize: (data: number) => {
315
- gb: number;
316
- mb: number;
317
- kb: number;
318
- b: number;
319
- total: number;
320
- desc: string;
321
- };
322
- toString: (value: any) => any;
323
- startCase: (string: any) => any;
324
- snakeCase: (string: any) => any;
325
- kebabCase: (string: any) => any;
326
- camelCase: (string: any) => any;
327
- upperCase: (string: any) => any;
328
- upperFirst: (string: any) => any;
329
- lowerCase: (string: any) => any;
330
- lowerFirst: (string: any) => any;
331
- splitOnFirst: (string: any, separator: any) => string[];
332
- parseValue: (value?: any, { number, boolean }?: {
333
- number?: boolean | undefined;
334
- boolean?: boolean | undefined;
335
- }) => any;
336
- replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
337
- jsonFormat: (jsonString: string) => string;
338
- toLines: (content: string, separator?: string | RegExp) => string[];
339
- sleep: (ms?: number) => Promise<unknown>;
340
- run: <T_1 = any>(task?: import("./typings").Ddan.PFunction<T_1> | undefined, wait?: number) => Promise<[any, undefined] | [null, T_1]>;
341
- exec: (func: import("./typings").Ddan.Function, taskId?: string) => import("./typings").Ddan.PSafeResult<any>;
342
- debounce: typeof import("./modules/hook/modules/debounce").default;
343
- throttle: typeof import("./modules/hook/modules/throttle").default;
344
- task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
345
- mutex: typeof import("./modules/hook/modules/mutex").default;
346
- polling: typeof import("./modules/hook/modules/polling").default;
347
- pipe: (func: import("./typings").Ddan.Function, callback?: ((result: import("./typings").Ddan.SafeResult<any>) => void) | undefined) => import("./modules/hook/modules/pipeline").default;
348
- pipeline: (max?: number) => import("./modules/hook/modules/pipeline").default;
349
- safeTask: (func: import("./typings").Ddan.Function, callback?: ((result: import("./typings").Ddan.SafeResult<any>) => void) | undefined) => import("./modules/hook/modules/safeTask").default;
350
- bezier1: (p0: import("./typings").Ddan.IPoint, p1: import("./typings").Ddan.IPoint, t: number) => import("./typings").Ddan.IPoint;
351
- bezier2: (p0: import("./typings").Ddan.IPoint, p1: import("./typings").Ddan.IPoint, p2: import("./typings").Ddan.IPoint, t: number) => import("./typings").Ddan.IPoint;
352
- bezier3: (p0: import("./typings").Ddan.IPoint, p1: import("./typings").Ddan.IPoint, p2: import("./typings").Ddan.IPoint, p3: import("./typings").Ddan.IPoint, t: number) => import("./typings").Ddan.IPoint;
353
- bezier: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
354
- bezierCurve: (points: import("./typings").Ddan.IPoint[], t: number) => import("./typings").Ddan.IPoint;
355
- lerpAverage: (points: import("./typings").Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
356
- proportion: (start: number, end: number, current: number) => number;
357
- logString: (data: any) => string;
358
- logParse: (logStr: string) => string;
359
- logRString: (data: any) => Promise<string>;
360
- logRParse: (logStr: string) => Promise<string>;
361
- to: <T_2 = any, U extends object = any>(promise: Promise<T_2>, errorExt?: object | undefined, fn?: import("./typings").Ddan.noop | undefined) => Promise<[null, T_2] | [U, undefined]>;
362
- go: <T_3 = any>(task?: import("./typings").Ddan.PFunction<T_3> | undefined, fn?: import("./typings").Ddan.noop | undefined) => Promise<[any, undefined] | [null, T_3]>;
363
- delay: (ms?: number) => Promise<unknown>;
364
- safeRun: <T_4 = any>(func: any, fn?: import("./typings").Ddan.noop | undefined) => Promise<[any, undefined] | [null, T_4]>;
365
- toError: (value: any) => any;
366
- timeout: <T_5 = any>(task?: import("./typings").Ddan.PFunction<T_5> | undefined, ms?: number, desc?: string) => Promise<[any, undefined] | [null, T_5]>;
367
- base64: {
368
- encode: (input: string) => string;
369
- decode: (base64Str: string) => string;
370
- encodeByOss: (input: string) => string;
371
- };
372
- tea: {
373
- TEAKey: string;
374
- encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
375
- decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
376
- toTeaKey: (str: string) => Uint32Array;
377
- encode: (plaintext: string, key: string) => string;
378
- decode: (ciphertext: string, key: string) => string;
379
- encodeBytes: (plainbytes: Uint8Array, key: string) => Uint8Array;
380
- decodeBytes: (cipherbytes: Uint8Array, key: string) => Uint8Array;
381
- };
382
- uuid: (len?: number, radix?: number) => string;
383
- guid: (len: number, prefix?: boolean, sep?: string) => string;
384
- getHexString: (len: number) => string;
385
- keyNumber: string;
386
- keyLower: string;
387
- keyUpper: string;
388
- keyChars: string;
389
- str2ab: (content?: string, base64?: boolean) => ArrayBuffer;
390
- ab2str: (data: ArrayBuffer, base64?: boolean) => string;
391
- utf8ToBase64: (str: string) => string;
392
- base64ToUtf8: (base64Str: string) => string;
393
- getRandomBytes: (length: number) => Uint8Array;
394
- textEncode: (text: string) => Uint8Array;
395
- textDecode: (buf: ArrayBufferLike) => string;
396
- toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
397
- md5: (input: string | Uint8Array) => string;
398
- md5Base64: (input: string | Uint8Array) => string;
399
- toBase64: (input?: string) => string;
400
- fromBase64: (input?: string) => string;
401
- bytesToBase64: (bytes: Uint8Array) => string;
402
- base64ToBytes: (input?: string) => Uint8Array;
403
- toUtf8: (content: string) => string;
404
- fromUtf8: (utftext: string) => string;
405
- toUtf8Bytes: (content: string) => Uint8Array;
406
- fromUtf8Bytes: (utf8Bytes: Uint8Array) => string;
407
- pkcs7Padding: (plaintext: Uint8Array, blockSize: number) => Uint8Array;
408
- pkcs7Unpadding: (ciphertext: Uint8Array) => Uint8Array;
409
- bytes2str: (bytes: Uint8Array) => string;
410
- str2bytes: (str?: string) => Uint8Array;
411
- str2hex: (str: string) => string;
412
- hex2str: (hexstr: string) => string;
413
- concatBytes: (...args: Uint8Array[]) => Uint8Array;
414
- uint32ToBytes: (uint32: Uint32Array) => Uint8Array;
415
- bytesToUint32: (bytes: Uint8Array) => Uint32Array;
416
- hex2bytes: (hex: string) => Uint8Array;
417
- bytes2hex: (bytes: Uint8Array) => string;
418
- toUint32: (str: string) => Uint32Array;
419
- fromUint32: (uint32: Uint32Array) => string;
420
- flatten: <T_6>(data: T_6[], recursive?: boolean, list?: T_6[]) => T_6[];
421
- copy: (source: any, options?: {
422
- fields?: string[] | undefined;
423
- camel?: boolean | undefined;
424
- pure?: boolean | undefined;
425
- ignoreNull?: boolean | undefined;
426
- ignoreZero?: boolean | undefined;
427
- ignoreEmptyArray?: boolean | undefined;
428
- ignoreEmptyString?: boolean | undefined;
429
- }) => any;
430
- clone: (source: any, weakMap?: WeakMap<object, any>) => any;
431
- cloneClass: <T_7>(source: T_7) => T_7;
432
- isEqual: <T_8 = any>(value: T_8, other: T_8, depth?: number) => boolean;
433
- isEqualArray: (value: any[], other: any[], depth?: number) => boolean;
434
- isEqualObject: (value: Record<string, any>, other: Record<string, any>, depth?: number) => boolean;
435
- isEqualValue: <T_9>(value: T_9, other: T_9, type: string) => boolean;
436
- isEqualAB: (value: ArrayBuffer, other: ArrayBuffer) => boolean;
437
- isEqualDeep: <T_10>(value: T_10, other: T_10) => boolean;
438
- };
439
240
  declare const dMini: {
440
241
  mini: {
441
242
  diff: typeof import("./modules/mini/diff").default;
@@ -0,0 +1,202 @@
1
+ declare const dHook: {
2
+ qs: {
3
+ parse: (qs: any, { sep, eq, max, multiple, uri, parseNumber, parseBoolean }?: {
4
+ sep?: string | undefined;
5
+ eq?: string | undefined;
6
+ max?: number | undefined;
7
+ multiple?: boolean | undefined;
8
+ uri?: boolean | undefined;
9
+ parseNumber?: boolean | undefined;
10
+ parseBoolean?: boolean | undefined;
11
+ }) => {};
12
+ stringify: (obj: any, { sep, eq, name, uri, cleanZero, cleanNull, cleanWhitespace }?: {
13
+ sep?: string | undefined;
14
+ eq?: string | undefined;
15
+ name?: null | undefined;
16
+ uri?: boolean | undefined;
17
+ cleanZero?: boolean | undefined;
18
+ cleanNull?: boolean | undefined;
19
+ cleanWhitespace?: boolean | undefined;
20
+ }) => string;
21
+ https: (url: string) => string;
22
+ parseUrl: (url: string) => {
23
+ pathname: string;
24
+ params: {};
25
+ route: string;
26
+ page: string;
27
+ name: string;
28
+ withoutExtension: string;
29
+ extname: string;
30
+ href: string;
31
+ url: string;
32
+ origin: string;
33
+ host: string;
34
+ protocol: string;
35
+ port: string;
36
+ query: string;
37
+ };
38
+ parsePath: (url: string) => {
39
+ route: string;
40
+ page: string;
41
+ name: string;
42
+ withoutExtension: string;
43
+ extname: string;
44
+ };
45
+ parseHost: (url: string) => import("..").Ddan.IHttpHost;
46
+ join: (...args: string[]) => string;
47
+ shExpMatch: (text: string, pattern: string) => boolean;
48
+ isLocalIpAddress: (addr: string) => boolean;
49
+ parseFileUrl: (url: string) => {
50
+ href: string;
51
+ file: string;
52
+ url: string;
53
+ protocol: string;
54
+ host: string;
55
+ query: string;
56
+ params: {};
57
+ };
58
+ };
59
+ singleton: <T>() => {
60
+ new (): {};
61
+ __instance__: any;
62
+ readonly Instance: T;
63
+ readonly I: T;
64
+ };
65
+ getset: <T_1 = any>(t?: T_1 | undefined) => import("..").Ddan.IGetset<T_1>;
66
+ random: (max: number) => number;
67
+ randomRange: (min: number, max: number) => number;
68
+ lerp: (start: number, end: number, t: number) => number;
69
+ randoms: (max: number, count?: number, repeat?: boolean) => number[];
70
+ strip: (num: string | number, digits?: number) => number;
71
+ float: (num: string | number, { digits, fixed }?: {
72
+ digits?: number | undefined;
73
+ fixed?: boolean | undefined;
74
+ }) => number;
75
+ radian2degree: (radians: number) => number;
76
+ degree2radian: (degrees: number) => number;
77
+ calcDataSize: (data: number) => {
78
+ gb: number;
79
+ mb: number;
80
+ kb: number;
81
+ b: number;
82
+ total: number;
83
+ desc: string;
84
+ };
85
+ toString: (value: any) => any;
86
+ startCase: (string: any) => any;
87
+ snakeCase: (string: any) => any;
88
+ kebabCase: (string: any) => any;
89
+ camelCase: (string: any) => any;
90
+ upperCase: (string: any) => any;
91
+ upperFirst: (string: any) => any;
92
+ lowerCase: (string: any) => any;
93
+ lowerFirst: (string: any) => any;
94
+ splitOnFirst: (string: any, separator: any) => string[];
95
+ parseValue: (value?: any, { number, boolean }?: {
96
+ number?: boolean | undefined;
97
+ boolean?: boolean | undefined;
98
+ }) => any;
99
+ replace: (source: string, rules: import("..").Ddan.IRegexRule | import("..").Ddan.IRegexRule[]) => string;
100
+ jsonFormat: (jsonString: string) => string;
101
+ toLines: (content: string, separator?: string | RegExp) => string[];
102
+ sleep: (ms?: number) => Promise<unknown>;
103
+ run: <T_2 = any>(task?: import("..").Ddan.PFunction<T_2> | undefined, wait?: number) => Promise<[any, undefined] | [null, T_2]>;
104
+ exec: (func: import("..").Ddan.Function, taskId?: string) => import("..").Ddan.PSafeResult<any>;
105
+ debounce: typeof import("../modules/hook/modules/debounce").default;
106
+ throttle: typeof import("../modules/hook/modules/throttle").default;
107
+ task: (param?: import("..").Ddan.Func1<any, any> | undefined) => import("../class/pipeTask").default;
108
+ mutex: typeof import("../modules/hook/modules/mutex").default;
109
+ polling: typeof import("../modules/hook/modules/polling").default;
110
+ pipe: (func: import("..").Ddan.Function, callback?: ((result: import("..").Ddan.SafeResult<any>) => void) | undefined) => import("../modules/hook/modules/pipeline").default;
111
+ pipeline: (max?: number) => import("../modules/hook/modules/pipeline").default;
112
+ safeTask: (func: import("..").Ddan.Function, callback?: ((result: import("..").Ddan.SafeResult<any>) => void) | undefined) => import("../modules/hook/modules/safeTask").default;
113
+ bezier1: (p0: import("..").Ddan.IPoint, p1: import("..").Ddan.IPoint, t: number) => import("..").Ddan.IPoint;
114
+ bezier2: (p0: import("..").Ddan.IPoint, p1: import("..").Ddan.IPoint, p2: import("..").Ddan.IPoint, t: number) => import("..").Ddan.IPoint;
115
+ bezier3: (p0: import("..").Ddan.IPoint, p1: import("..").Ddan.IPoint, p2: import("..").Ddan.IPoint, p3: import("..").Ddan.IPoint, t: number) => import("..").Ddan.IPoint;
116
+ bezier: (points: import("..").Ddan.IPoint[], t: number) => import("..").Ddan.IPoint;
117
+ bezierCurve: (points: import("..").Ddan.IPoint[], t: number) => import("..").Ddan.IPoint;
118
+ lerpAverage: (points: import("..").Ddan.IPoint[], step: number, type?: "" | "lerp") => number;
119
+ proportion: (start: number, end: number, current: number) => number;
120
+ logString: (data: any) => string;
121
+ logParse: (logStr: string) => string;
122
+ logRString: (data: any) => Promise<string>;
123
+ logRParse: (logStr: string) => Promise<string>;
124
+ to: <T_3 = any, U extends object = any>(promise: Promise<T_3>, errorExt?: object | undefined, fn?: import("..").Ddan.noop | undefined) => Promise<[null, T_3] | [U, undefined]>;
125
+ go: <T_4 = any>(task?: import("..").Ddan.PFunction<T_4> | undefined, fn?: import("..").Ddan.noop | undefined) => Promise<[any, undefined] | [null, T_4]>;
126
+ delay: (ms?: number) => Promise<unknown>;
127
+ safeRun: <T_5 = any>(func: any, fn?: import("..").Ddan.noop | undefined) => Promise<[any, undefined] | [null, T_5]>;
128
+ toError: (value: any) => any;
129
+ timeout: <T_6 = any>(task?: import("..").Ddan.PFunction<T_6> | undefined, ms?: number, desc?: string) => Promise<[any, undefined] | [null, T_6]>;
130
+ base64: {
131
+ encode: (input: string) => string;
132
+ decode: (base64Str: string) => string;
133
+ encodeByOss: (input: string) => string;
134
+ };
135
+ tea: {
136
+ TEAKey: string;
137
+ encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
138
+ decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
139
+ toTeaKey: (str: string) => Uint32Array;
140
+ encode: (plaintext: string, key: string) => string;
141
+ decode: (ciphertext: string, key: string) => string;
142
+ encodeBytes: (plainbytes: Uint8Array, key: string) => Uint8Array;
143
+ decodeBytes: (cipherbytes: Uint8Array, key: string) => Uint8Array;
144
+ };
145
+ uuid: (len?: number, radix?: number) => string;
146
+ guid: (len: number, prefix?: boolean, sep?: string) => string;
147
+ getHexString: (len: number) => string;
148
+ keyNumber: string;
149
+ keyLower: string;
150
+ keyUpper: string;
151
+ keyChars: string;
152
+ str2ab: (content?: string, base64?: boolean) => ArrayBuffer;
153
+ ab2str: (data: ArrayBuffer, base64?: boolean) => string;
154
+ utf8ToBase64: (str: string) => string;
155
+ base64ToUtf8: (base64Str: string) => string;
156
+ getRandomBytes: (length: number) => Uint8Array;
157
+ textEncode: (text: string) => Uint8Array;
158
+ textDecode: (buf: ArrayBufferLike) => string;
159
+ toDataUrl: (textOrBuf: string | ArrayBuffer, contentType?: string) => string;
160
+ md5: (input: string | Uint8Array) => string;
161
+ md5Base64: (input: string | Uint8Array) => string;
162
+ toBase64: (input?: string) => string;
163
+ fromBase64: (input?: string) => string;
164
+ bytesToBase64: (bytes: Uint8Array) => string;
165
+ base64ToBytes: (input?: string) => Uint8Array;
166
+ toUtf8: (content: string) => string;
167
+ fromUtf8: (utftext: string) => string;
168
+ toUtf8Bytes: (content: string) => Uint8Array;
169
+ fromUtf8Bytes: (utf8Bytes: Uint8Array) => string;
170
+ pkcs7Padding: (plaintext: Uint8Array, blockSize: number) => Uint8Array;
171
+ pkcs7Unpadding: (ciphertext: Uint8Array) => Uint8Array;
172
+ bytes2str: (bytes: Uint8Array) => string;
173
+ str2bytes: (str?: string) => Uint8Array;
174
+ str2hex: (str: string) => string;
175
+ hex2str: (hexstr: string) => string;
176
+ concatBytes: (...args: Uint8Array[]) => Uint8Array;
177
+ uint32ToBytes: (uint32: Uint32Array) => Uint8Array;
178
+ bytesToUint32: (bytes: Uint8Array) => Uint32Array;
179
+ hex2bytes: (hex: string) => Uint8Array;
180
+ bytes2hex: (bytes: Uint8Array) => string;
181
+ toUint32: (str: string) => Uint32Array;
182
+ fromUint32: (uint32: Uint32Array) => string;
183
+ flatten: <T_7>(data: T_7[], recursive?: boolean, list?: T_7[]) => T_7[];
184
+ copy: (source: any, options?: {
185
+ fields?: string[] | undefined;
186
+ camel?: boolean | undefined;
187
+ pure?: boolean | undefined;
188
+ ignoreNull?: boolean | undefined;
189
+ ignoreZero?: boolean | undefined;
190
+ ignoreEmptyArray?: boolean | undefined;
191
+ ignoreEmptyString?: boolean | undefined;
192
+ }) => any;
193
+ clone: (source: any, weakMap?: WeakMap<object, any>) => any;
194
+ cloneClass: <T_8>(source: T_8) => T_8;
195
+ isEqual: <T_9 = any>(value: T_9, other: T_9, depth?: number) => boolean;
196
+ isEqualArray: (value: any[], other: any[], depth?: number) => boolean;
197
+ isEqualObject: (value: Record<string, any>, other: Record<string, any>, depth?: number) => boolean;
198
+ isEqualValue: <T_10>(value: T_10, other: T_10, type: string) => boolean;
199
+ isEqualAB: (value: ArrayBuffer, other: ArrayBuffer) => boolean;
200
+ isEqualDeep: <T_11>(value: T_11, other: T_11) => boolean;
201
+ };
202
+ export default dHook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "2.10.2",
3
+ "version": "2.10.4",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "ddan-js",