ddan-js 2.2.7 → 2.2.9

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.
@@ -1,8 +1,382 @@
1
- export { Xhao } from "./typings/xhao";
2
- import Http from "./modules/http";
3
- import Event from "./class/event";
4
- import Store from "./class/store";
5
- import Persist from "./class/persist";
1
+ export { Ddan } from './typings';
2
+ import Http from './modules/http';
3
+ import Event from './class/event';
4
+ import Store from './class/store';
5
+ import Persist from './class/persist';
6
+ declare const dUtil: {
7
+ includes: typeof import("./util/includes").default;
8
+ forof: (source: any, cb: (key: any, val: any) => void) => void;
9
+ copy: (source: any, options?: {
10
+ fields?: string[] | undefined;
11
+ camel?: boolean | undefined;
12
+ pure?: boolean | undefined;
13
+ } & import("./typings").dd.IIgnoreParams) => any;
14
+ clone: (source: any) => any;
15
+ merge: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => {};
16
+ isEmpty: (source: any) => boolean;
17
+ parseValue: (source: any, { number, boolean }?: {
18
+ number?: boolean | undefined;
19
+ boolean?: boolean | undefined;
20
+ }) => any;
21
+ cloneClass: <T>(source: T) => T;
22
+ combine: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => any;
23
+ combines: (objs: any[], options?: import("./typings").dd.IIgnoreParams) => {};
24
+ observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
25
+ getTag: (value: any) => string;
26
+ getType: (value: any) => string;
27
+ toString: () => string;
28
+ hasOwnProperty: (v: PropertyKey) => boolean;
29
+ propertyIsEnumerable: (v: PropertyKey) => boolean;
30
+ is: (val: any, type: string) => boolean;
31
+ isNumber: (value: any) => boolean;
32
+ isString: (value: any) => boolean;
33
+ isObject: (value: any) => boolean;
34
+ isObjectLike: (value: any) => boolean;
35
+ isPlainObject: (value: any) => boolean;
36
+ isSymbol: (value: any) => boolean;
37
+ isFunction: (value: any) => boolean;
38
+ isArray: (arg: any) => arg is any[];
39
+ isArrayLikeObject: (value: any) => boolean;
40
+ isIndex: (value: any, length: number) => boolean;
41
+ isArrayLike: (value: any) => boolean;
42
+ isPrototype: (value: any) => boolean;
43
+ isArguments: (value: any) => boolean;
44
+ isPromise: (value: any) => boolean;
45
+ gbk: {
46
+ gbkLength: (str: string) => number;
47
+ gbkCut: (source: string, len: number) => string;
48
+ };
49
+ math: {
50
+ random: (max: number) => number;
51
+ randomRange: (min: number, max: number) => number;
52
+ lerp: (start: number, end: number, t: number) => number;
53
+ randoms: (max: number, count?: number, repeat?: boolean) => number[];
54
+ strip: (num: string | number, fractionDigits?: number) => number;
55
+ float: (num: string | number, { fractionDigits, fixed }?: {
56
+ fractionDigits?: number | undefined;
57
+ fixed?: boolean | undefined;
58
+ }) => number;
59
+ radian2degree: (radians: number) => number;
60
+ degree2radian: (degrees: number) => number;
61
+ };
62
+ list: {
63
+ stepAction: <T_1>(list: T_1[], func: import("./typings").Ddan.Task<T_1, void>, stepCount?: number) => void;
64
+ skip: <T_2>(list: T_2[], count: number) => T_2[];
65
+ take: <T_3>(list: T_3[], count: number, skip?: number) => T_3[];
66
+ distinct: <T_4>(list: T_4[]) => T_4[];
67
+ randoms: <T_5>(list: T_5[], count?: number, repeat?: boolean) => T_5[];
68
+ toKV: (list: import("./typings").Ddan.KV<any>[], key: string, value: string) => import("./typings").Ddan.KV<any>;
69
+ groupBy: <T_6>(list: T_6[], key: string) => Record<string, T_6[]>;
70
+ first: <T_7>(list: T_7[]) => T_7 | undefined;
71
+ last: <T_8>(list: T_8[]) => T_8 | undefined;
72
+ toList: <T_9>(val: T_9 | T_9[]) => T_9[];
73
+ };
74
+ string: {
75
+ toString: (value: any) => any;
76
+ startCase: (string: any) => any;
77
+ snakeCase: (string: any) => any;
78
+ kebabCase: (string: any) => any;
79
+ camelCase: (string: any) => any;
80
+ upperCase: (string: any) => any;
81
+ upperFirst: (string: any) => any;
82
+ lowerCase: (string: any) => any;
83
+ lowerFirst: (string: any) => any;
84
+ splitOnFirst: (string: any, separator: any) => string[];
85
+ parseValue: (value?: any, { number, boolean }?: {
86
+ number?: boolean | undefined;
87
+ boolean?: boolean | undefined;
88
+ }) => any;
89
+ replace: (source: string, rules: import("./typings").dd.IRegexRule | import("./typings").dd.IRegexRule[]) => string;
90
+ };
91
+ time: {
92
+ now: () => import("./modules/time/dtime").default;
93
+ isToday: (date: any) => any;
94
+ parseTimestamp: ({ year, month, date, hour, minute, second }: {
95
+ year?: number | undefined;
96
+ month?: number | undefined;
97
+ date?: number | undefined;
98
+ hour?: number | undefined;
99
+ minute?: number | undefined;
100
+ second?: number | undefined;
101
+ }) => number;
102
+ todayZero: () => number;
103
+ format: (time: string | number | Date, reg?: string) => string;
104
+ countdown: (endTime: string | number | Date, reg?: string) => "" | import("./modules/time/dtime").IDCountdownFormat;
105
+ dtime: (time: string | number | Date) => import("./modules/time/dtime").default;
106
+ loopFrame: (interval?: number) => import("./modules/time/frame").default;
107
+ oneDay: number;
108
+ oneHour: number;
109
+ oneMinute: number;
110
+ oneSecond: number;
111
+ };
112
+ obj: {
113
+ copy: (source: any, options?: {
114
+ fields?: string[] | undefined;
115
+ camel?: boolean | undefined;
116
+ pure?: boolean | undefined;
117
+ } & import("./typings").dd.IIgnoreParams) => any;
118
+ clone: (source: any) => any;
119
+ merge: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => {};
120
+ isEmpty: (source: any) => boolean;
121
+ parseValue: (source: any, { number, boolean }?: {
122
+ number?: boolean | undefined;
123
+ boolean?: boolean | undefined;
124
+ }) => any;
125
+ cloneClass: <T>(source: T) => T;
126
+ combine: (target: any, source: any, options?: import("./typings").dd.IIgnoreParams) => any;
127
+ combines: (objs: any[], options?: import("./typings").dd.IIgnoreParams) => {};
128
+ observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
129
+ };
130
+ crypto: {
131
+ base64: {
132
+ encode: (input: string) => string;
133
+ decode: (input: string) => string;
134
+ encodeByOss: (input: string) => string;
135
+ };
136
+ uuid: (len?: number, radix?: number) => string;
137
+ getNewId: (len: number, prefix?: boolean, sep?: string) => string;
138
+ keyNumber: string;
139
+ keyLower: string;
140
+ keyUpper: string;
141
+ keyChars: string;
142
+ };
143
+ convert: {
144
+ uint8ArrayToString: (arr: any) => string;
145
+ stringToArrayBuffer: (str: any) => ArrayBuffer;
146
+ arrayBufferToString: (data: ArrayBuffer, base64?: boolean) => string;
147
+ };
148
+ rule: {
149
+ validateId: (content: any) => boolean;
150
+ validatePhone: (content: any) => boolean;
151
+ validator: (rules: import("./modules/rule/async-validator").Rules) => import("./modules/rule/async-validator").default;
152
+ validate: (rules: import("./modules/rule/async-validator").Rules, source_: import("./modules/rule/async-validator").Values, o?: any, oc?: any) => Promise<import("./modules/rule/async-validator").Values>;
153
+ isChinese: (content: string) => boolean;
154
+ isNumber: (content: string) => boolean;
155
+ isFloat: (content: string) => boolean;
156
+ isPhoneNumber: (content: any) => boolean;
157
+ };
158
+ regex: {
159
+ pattern: {
160
+ num: string;
161
+ zh: string;
162
+ en: string;
163
+ };
164
+ regex: (patt: string, modifiers?: "i" | "g" | "m" | undefined) => RegExp;
165
+ entire: {
166
+ chinese: RegExp;
167
+ real: RegExp;
168
+ cssReal: RegExp;
169
+ id: RegExp;
170
+ yyyyMMdd: RegExp;
171
+ };
172
+ };
173
+ };
174
+ declare const dHook: {
175
+ run: (task?: Function | Promise<any> | undefined, wait?: number) => Promise<[null, any] | [any, undefined]>;
176
+ exec: (func: Function, taskId?: string) => Promise<any[]>;
177
+ debounce: typeof import("./modules/hook/debounce").default;
178
+ throttle: typeof import("./modules/hook/throttle").default;
179
+ task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
180
+ mutex: typeof import("./modules/hook/mutex").default;
181
+ to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
182
+ delay: (time?: number) => Promise<unknown>;
183
+ };
184
+ declare const dMini: {
185
+ mini: {
186
+ diff: typeof import("./modules/mini/diff").default;
187
+ promixify: (miniapi: any) => any;
188
+ run: (func: any, args?: {}) => Promise<[null, any] | [any, undefined]>;
189
+ formatList: (lists: any[], start: any, name: any) => any;
190
+ ruleValidator: (_: any, value: any) => boolean;
191
+ Http: typeof import("./modules/mini/http").default;
192
+ setWatcher: (page: any) => void;
193
+ };
194
+ css: {
195
+ stringify: (styleObj: Record<string, string | number>) => string;
196
+ parse: (styleStr: string, { camel, pure }?: {
197
+ camel?: boolean | undefined;
198
+ pure?: boolean | undefined;
199
+ }) => {} | undefined;
200
+ fixValue: (value: string | number, unit?: string) => string | number;
201
+ style: (cssKV: Record<string, any>, unit?: string) => string;
202
+ commonFields: string[];
203
+ };
204
+ qs: {
205
+ parse: (qs: any, { sep, eq, max, multiple, uri, parseNumber, parseBoolean }?: {
206
+ sep?: string | undefined;
207
+ eq?: string | undefined;
208
+ max?: number | undefined;
209
+ multiple?: boolean | undefined;
210
+ uri?: boolean | undefined;
211
+ parseNumber?: boolean | undefined;
212
+ parseBoolean?: boolean | undefined;
213
+ }) => {};
214
+ stringify: (obj: any, { sep, eq, name, uri, cleanZero, cleanNull, cleanWhitespace }?: {
215
+ sep?: string | undefined;
216
+ eq?: string | undefined;
217
+ name?: null | undefined;
218
+ uri?: boolean | undefined;
219
+ cleanZero?: boolean | undefined;
220
+ cleanNull?: boolean | undefined;
221
+ cleanWhitespace?: boolean | undefined;
222
+ }) => string;
223
+ https: (url: string) => string;
224
+ parseUrl: (url: string) => {
225
+ url: string;
226
+ path: string;
227
+ page: string;
228
+ query: string;
229
+ params: {};
230
+ };
231
+ parsePath: (path: string) => {
232
+ root: string;
233
+ name: string;
234
+ withoutExtension: string;
235
+ extension: string;
236
+ };
237
+ join: (...args: string[]) => string;
238
+ };
239
+ icon: import("./class/icon").DIcon;
240
+ html: {
241
+ dataURLtoFile: (dataurl: any, filename: any) => File;
242
+ dataURLtoBlob: (dataurl: any) => Blob;
243
+ blobToFile: (theBlob: any, fileName: any) => any;
244
+ readAsDataURL: (file: any, cb: any) => void;
245
+ downloadUrl: (filename: string, url: string) => void;
246
+ download: (filename: string, obj: string | Blob | MediaSource) => void;
247
+ downloadImage: (url: string) => Promise<void> | undefined;
248
+ watermark: (text: string, { width, height, angle, fillStyle, font, textAlign, textBaseline }?: {
249
+ width?: number | undefined;
250
+ height?: number | undefined;
251
+ angle?: number | undefined;
252
+ fillStyle?: string | undefined;
253
+ font?: string | undefined;
254
+ textAlign?: "center" | "end" | "left" | "right" | "start" | undefined;
255
+ textBaseline?: "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top" | undefined;
256
+ }) => string;
257
+ };
258
+ };
259
+ declare const dCdn: {
260
+ cdn: {
261
+ ossImage: (url: string, options?: {
262
+ webp?: boolean | undefined;
263
+ resize?: number | undefined;
264
+ interlace?: boolean | undefined;
265
+ domain?: string | string[] | undefined;
266
+ }) => string;
267
+ ossSnapshot: (url: string, options?: {
268
+ t?: number | undefined;
269
+ w?: number | undefined;
270
+ h?: number | undefined;
271
+ m?: "" | "fast" | undefined;
272
+ f?: "jpg" | "png" | undefined;
273
+ ar?: "auto" | "h" | "w" | undefined;
274
+ }) => string;
275
+ };
276
+ watermark: (bg: string, size?: {
277
+ width?: number | undefined;
278
+ height?: number | undefined;
279
+ } | undefined) => import("./class/watermark").DWatermark;
280
+ };
281
+ declare const dClass: {
282
+ Event: typeof Event;
283
+ Http: typeof Http;
284
+ };
285
+ declare const dStore: {
286
+ Store: typeof Store;
287
+ storeRef: (source: import("./typings").dd.IDStore, persistConfig?: import("./typings").dd.IDPersistConfig | undefined) => any;
288
+ Persist: typeof Persist;
289
+ persistConfig: (key: string, fields: string[], storage: import("./typings").dd.DStorage) => import("./typings").dd.IDPersistConfig;
290
+ };
291
+ declare const dJoker: import("./class/joker").Joker;
292
+ declare const dTracker: import("./class/tracker").DTracker;
293
+ declare const dLogger: {
294
+ override: () => void;
295
+ log: (...args: any[]) => void;
296
+ info: (...args: any[]) => void;
297
+ warn: (...args: any[]) => void;
298
+ error: (...args: any[]) => void;
299
+ config: ({ tag, format }?: {
300
+ tag?: boolean | undefined;
301
+ format?: string | undefined;
302
+ }) => void;
303
+ };
304
+ declare const dWeb: {
305
+ fetch: {
306
+ getDataURL: (url: string) => Promise<[any, undefined] | [null, {
307
+ contentType: string;
308
+ dataUrl: string;
309
+ }]>;
310
+ getArrayBuffer: (url: string) => Promise<[any, undefined] | [null, ArrayBuffer]>;
311
+ getJson: (url: string) => Promise<[null, any] | [any, undefined]>;
312
+ };
313
+ Http: typeof Http;
314
+ css: {
315
+ stringify: (styleObj: Record<string, string | number>) => string;
316
+ parse: (styleStr: string, { camel, pure }?: {
317
+ camel?: boolean | undefined;
318
+ pure?: boolean | undefined;
319
+ }) => {} | undefined;
320
+ fixValue: (value: string | number, unit?: string) => string | number;
321
+ style: (cssKV: Record<string, any>, unit?: string) => string;
322
+ commonFields: string[];
323
+ };
324
+ qs: {
325
+ parse: (qs: any, { sep, eq, max, multiple, uri, parseNumber, parseBoolean }?: {
326
+ sep?: string | undefined;
327
+ eq?: string | undefined;
328
+ max?: number | undefined;
329
+ multiple?: boolean | undefined;
330
+ uri?: boolean | undefined;
331
+ parseNumber?: boolean | undefined;
332
+ parseBoolean?: boolean | undefined;
333
+ }) => {};
334
+ stringify: (obj: any, { sep, eq, name, uri, cleanZero, cleanNull, cleanWhitespace }?: {
335
+ sep?: string | undefined;
336
+ eq?: string | undefined;
337
+ name?: null | undefined;
338
+ uri?: boolean | undefined;
339
+ cleanZero?: boolean | undefined;
340
+ cleanNull?: boolean | undefined;
341
+ cleanWhitespace?: boolean | undefined;
342
+ }) => string;
343
+ https: (url: string) => string;
344
+ parseUrl: (url: string) => {
345
+ url: string;
346
+ path: string;
347
+ page: string;
348
+ query: string;
349
+ params: {};
350
+ };
351
+ parsePath: (path: string) => {
352
+ root: string;
353
+ name: string;
354
+ withoutExtension: string;
355
+ extension: string;
356
+ };
357
+ join: (...args: string[]) => string;
358
+ };
359
+ icon: import("./class/icon").DIcon;
360
+ html: {
361
+ dataURLtoFile: (dataurl: any, filename: any) => File;
362
+ dataURLtoBlob: (dataurl: any) => Blob;
363
+ blobToFile: (theBlob: any, fileName: any) => any;
364
+ readAsDataURL: (file: any, cb: any) => void;
365
+ downloadUrl: (filename: string, url: string) => void;
366
+ download: (filename: string, obj: string | Blob | MediaSource) => void;
367
+ downloadImage: (url: string) => Promise<void> | undefined;
368
+ watermark: (text: string, { width, height, angle, fillStyle, font, textAlign, textBaseline }?: {
369
+ width?: number | undefined;
370
+ height?: number | undefined;
371
+ angle?: number | undefined;
372
+ fillStyle?: string | undefined;
373
+ font?: string | undefined;
374
+ textAlign?: "center" | "end" | "left" | "right" | "start" | undefined;
375
+ textBaseline?: "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top" | undefined;
376
+ }) => string;
377
+ };
378
+ };
379
+ export { dUtil, dHook, dWeb, dMini, dCdn, dClass, dStore, dJoker, dTracker, dLogger };
6
380
  declare const _default: {
7
381
  gbk: {
8
382
  gbkLength: (str: string) => number;
@@ -30,15 +404,14 @@ declare const _default: {
30
404
  oneSecond: number;
31
405
  };
32
406
  hook: {
33
- sleep: (time?: number) => Promise<unknown>;
34
407
  run: (task?: Function | Promise<any> | undefined, wait?: number) => Promise<[null, any] | [any, undefined]>;
35
408
  exec: (func: Function, taskId?: string) => Promise<any[]>;
36
409
  debounce: typeof import("./modules/hook/debounce").default;
37
410
  throttle: typeof import("./modules/hook/throttle").default;
38
- task: (param?: import("./typings/xhao").Xhao.Func1<any, any> | undefined) => import("./class/pipeTask").default;
39
- delay: (time?: number) => Promise<unknown>;
411
+ task: (param?: import("./typings").Ddan.Func1<any, any> | undefined) => import("./class/pipeTask").default;
40
412
  mutex: typeof import("./modules/hook/mutex").default;
41
413
  to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
414
+ delay: (time?: number) => Promise<unknown>;
42
415
  };
43
416
  math: {
44
417
  random: (max: number) => number;
@@ -94,12 +467,12 @@ declare const _default: {
94
467
  isPromise: (value: any) => boolean;
95
468
  };
96
469
  list: {
97
- stepAction: <T_2>(list: T_2[], func: import("./typings/xhao").Xhao.Task<T_2, void>, stepCount?: number) => void;
470
+ stepAction: <T_2>(list: T_2[], func: import("./typings").Ddan.Task<T_2, void>, stepCount?: number) => void;
98
471
  skip: <T_3>(list: T_3[], count: number) => T_3[];
99
472
  take: <T_4>(list: T_4[], count: number, skip?: number) => T_4[];
100
473
  distinct: <T_5>(list: T_5[]) => T_5[];
101
474
  randoms: <T_6>(list: T_6[], count?: number, repeat?: boolean) => T_6[];
102
- toKV: (list: import("./typings/xhao").Xhao.KV<any>[], key: string, value: string) => import("./typings/xhao").Xhao.KV<any>;
475
+ toKV: (list: import("./typings").Ddan.KV<any>[], key: string, value: string) => import("./typings").Ddan.KV<any>;
103
476
  groupBy: <T_7>(list: T_7[], key: string) => Record<string, T_7[]>;
104
477
  first: <T_8>(list: T_8[]) => T_8 | undefined;
105
478
  last: <T_9>(list: T_9[]) => T_9 | undefined;
@@ -147,7 +520,7 @@ declare const _default: {
147
520
  encodeByOss: (input: string) => string;
148
521
  };
149
522
  uuid: (len?: number, radix?: number) => string;
150
- newId: (len: number, prefix?: boolean, sep?: string) => string;
523
+ getNewId: (len: number, prefix?: boolean, sep?: string) => string;
151
524
  keyNumber: string;
152
525
  keyLower: string;
153
526
  keyUpper: string;
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  encodeByOss: (input: string) => string;
6
6
  };
7
7
  uuid: (len?: number, radix?: number) => string;
8
- newId: (len: number, prefix?: boolean, sep?: string) => string;
8
+ getNewId: (len: number, prefix?: boolean, sep?: string) => string;
9
9
  keyNumber: string;
10
10
  keyLower: string;
11
11
  keyUpper: string;
@@ -1,5 +1,6 @@
1
1
  declare function to<T = any, U extends object = any>(promise: Promise<T>, errorExt?: object): Promise<[null, T] | [U, undefined]>;
2
2
  declare const _default: {
3
3
  to: typeof to;
4
+ delay: (time?: number) => Promise<unknown>;
4
5
  };
5
6
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import { dd } from '../../typings';
2
- import { Xhao } from '../../typings/xhao';
2
+ import { Ddan } from '../../typings';
3
3
  /**
4
4
  * 防抖 一段时间内,规定时间间隔多次执行,回调触发一次
5
5
  * @param func
@@ -7,7 +7,7 @@ import { Xhao } from '../../typings/xhao';
7
7
  * @param options 参数:leading 开始执行, trailing结束执行
8
8
  * @returns
9
9
  */
10
- declare function debounce(func: Xhao.Action, wait?: number, options?: dd.IDebounceOption): {
10
+ declare function debounce(func: Ddan.Action, wait?: number, options?: dd.IDebounceOption): {
11
11
  (...debouncedArgs: any[]): any;
12
12
  cancel: () => void;
13
13
  flush: () => any;
@@ -2,16 +2,15 @@ import debounce from "./debounce";
2
2
  import throttle from "./throttle";
3
3
  import mutex from "./mutex";
4
4
  import DPipeTask from "../../class/pipeTask";
5
- import { Xhao } from "../../typings/xhao";
5
+ import { Ddan } from "../../typings";
6
6
  declare const _default: {
7
- sleep: (time?: number) => Promise<unknown>;
8
7
  run: (task?: Function | Promise<any> | undefined, wait?: number) => Promise<[null, any] | [any, undefined]>;
9
8
  exec: (func: Function, taskId?: string) => Promise<any[]>;
10
9
  debounce: typeof debounce;
11
10
  throttle: typeof throttle;
12
- task: (param?: Xhao.Func1<any, any> | undefined) => DPipeTask;
13
- delay: (time?: number) => Promise<unknown>;
11
+ task: (param?: Ddan.Func1<any, any> | undefined) => DPipeTask;
14
12
  mutex: typeof mutex;
15
13
  to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
14
+ delay: (time?: number) => Promise<unknown>;
16
15
  };
17
16
  export default _default;
@@ -1,3 +1,3 @@
1
- import { Xhao } from "../../typings/xhao";
2
- declare function mutex(func: Xhao.Action): (...args: any[]) => Promise<false | undefined>;
1
+ import { Ddan } from "../../typings";
2
+ declare function mutex(func: Ddan.Action): (...args: any[]) => Promise<false | undefined>;
3
3
  export default mutex;
@@ -1,5 +1,5 @@
1
1
  import { dd } from "../../typings";
2
- import { Xhao } from "../../typings/xhao";
2
+ import { Ddan } from "../../typings";
3
3
  /**
4
4
  * 节流 每个间隔内,触发一次
5
5
  * @param func
@@ -7,7 +7,7 @@ import { Xhao } from "../../typings/xhao";
7
7
  * @param options 参数:leading 开始执行, trailing结束执行
8
8
  * @returns
9
9
  */
10
- declare function throttle(func: Xhao.Action, wait?: number, options?: Omit<dd.IDebounceOption, 'maxWait'>): {
10
+ declare function throttle(func: Ddan.Action, wait?: number, options?: Omit<dd.IDebounceOption, 'maxWait'>): {
11
11
  (...debouncedArgs: any[]): any;
12
12
  cancel: () => void;
13
13
  flush: () => any;
@@ -1,6 +1,6 @@
1
1
  import Interceptor from "./interceptor";
2
2
  import { dd } from "../../typings";
3
- import { Xhao } from "../../typings/xhao";
3
+ import { Ddan } from "../../typings";
4
4
  export default class Http implements dd.IHttp {
5
5
  host: string;
6
6
  reqConfig: {};
@@ -33,5 +33,5 @@ export default class Http implements dd.IHttp {
33
33
  * @param {object} req
34
34
  */
35
35
  getIdFromReqUrl(req: any): any;
36
- fetch(name: string, payload?: Xhao.KV): Promise<any>;
36
+ fetch(name: string, payload?: Ddan.KV): Promise<any>;
37
37
  }
@@ -1,4 +1,4 @@
1
- import { Xhao } from "../../typings/xhao";
1
+ import { Ddan } from "../../typings";
2
2
  /**
3
3
  * 分步动作
4
4
  * @param list 列表
@@ -6,7 +6,7 @@ import { Xhao } from "../../typings/xhao";
6
6
  * @param stepCount 每步数量
7
7
  * @returns
8
8
  */
9
- declare function stepAction<T>(list: T[], func: Xhao.Task<T>, stepCount?: number): void;
9
+ declare function stepAction<T>(list: T[], func: Ddan.Task<T>, stepCount?: number): void;
10
10
  /**
11
11
  * 跳过数据
12
12
  * @param list 列表
@@ -35,7 +35,7 @@ declare const _default: {
35
35
  take: typeof take;
36
36
  distinct: typeof distinct;
37
37
  randoms: typeof randoms;
38
- toKV: (list: Xhao.KV<any>[], key: string, value: string) => Xhao.KV<any>;
38
+ toKV: (list: Ddan.KV<any>[], key: string, value: string) => Ddan.KV<any>;
39
39
  groupBy: <T>(list: T[], key: string) => Record<string, T[]>;
40
40
  first: <T_1>(list: T_1[]) => T_1 | undefined;
41
41
  last: <T_2>(list: T_2[]) => T_2 | undefined;
@@ -1,5 +1,21 @@
1
1
  import DPersist from "../class/persist";
2
- import { Xhao } from "./xhao";
2
+ export declare namespace Ddan {
3
+ type KV<T = any> = Record<string, T>;
4
+ type KeyValueOjbect<T = any> = {
5
+ key: string;
6
+ value: T;
7
+ };
8
+ type KeyValue<T = any> = Required<KeyValueOjbect<T>>;
9
+ type Callback<T extends any[] = unknown[], R = any> = (...args: T) => R;
10
+ type Action<T extends any[] = unknown[]> = Callback<T, void>;
11
+ type Task<T = any, R = void> = Callback<[T[]], R>;
12
+ type Func<R = any> = Callback<[], R>;
13
+ type Func1<T = any, R = any> = Callback<[T], R>;
14
+ type Func2<T0 = any, T1 = any, R = any> = Callback<[T0, T1], R>;
15
+ type Func3<T0 = any, T1 = any, T2 = any, R = any> = Callback<[T0, T1, T2], R>;
16
+ type Func4<T0 = any, T1 = any, T2 = any, T3 = any, R = any> = Callback<[T0, T1, T2, T3], R>;
17
+ type Result<T = any> = T | Promise<T>;
18
+ }
3
19
  export declare namespace dd {
4
20
  type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
5
21
  /**
@@ -46,14 +62,14 @@ export declare namespace dd {
46
62
  interface IHttpApiConfig {
47
63
  [key: string]: IHttpRequestInit;
48
64
  }
49
- type ResponseInterceptFunc = Xhao.Func1<IHttpResponse>;
50
- type RequestInterceptFunc = Xhao.Func1<IHttpRequest, IHttpRequest>;
65
+ type ResponseInterceptFunc = Ddan.Func1<IHttpResponse>;
66
+ type RequestInterceptFunc = Ddan.Func1<IHttpRequest, IHttpRequest>;
51
67
  interface IHttpConfig {
52
68
  host?: string;
53
69
  config: IHttpApiConfig;
54
70
  handleRequest?: RequestInterceptFunc | RequestInterceptFunc[];
55
71
  handleResponse?: ResponseInterceptFunc | ResponseInterceptFunc[];
56
- handleError?: Xhao.Func1;
72
+ handleError?: Ddan.Func1;
57
73
  }
58
74
  interface IHttpRequestInit extends RequestInit {
59
75
  [key: string]: any;
@@ -74,7 +90,7 @@ export declare namespace dd {
74
90
  }
75
91
  interface IHttpResponse {
76
92
  response: Response & Record<string, any>;
77
- config?: Xhao.KV;
93
+ config?: Ddan.KV;
78
94
  refetch: () => Promise<any>;
79
95
  }
80
96
  interface IMiniHttpOptions {
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "ddan-js",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "description": "",
5
- "keywords": [],
5
+ "keywords": [
6
+ "ddan-js",
7
+ "ddan",
8
+ "Ddan",
9
+ "dUtil",
10
+ "dHook",
11
+ "dWeb",
12
+ "dMini",
13
+ "dCdn",
14
+ "dClass",
15
+ "dStore",
16
+ "dJoker",
17
+ "dTracker",
18
+ "dLogger"
19
+ ],
6
20
  "main": "bin/ddan-js.js",
7
21
  "module": "bin/ddan-js.esm.js",
8
22
  "typings": "bin/types/index.d.ts",
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- export declare namespace Xhao {
2
- type KV<T = any> = Record<string, T>;
3
- type KeyValueOjbect<T = any> = {
4
- key: string;
5
- value: T;
6
- };
7
- type KeyValue<T = any> = Required<KeyValueOjbect<T>>;
8
- type Callback<T extends any[] = unknown[], R = any> = (...args: T) => R;
9
- type Action<T extends any[] = unknown[]> = Callback<T, void>;
10
- type Task<T = any, R = void> = Callback<[T[]], R>;
11
- type Func<R = any> = Callback<[], R>;
12
- type Func1<T = any, R = any> = Callback<[T], R>;
13
- type Func2<T0 = any, T1 = any, R = any> = Callback<[T0, T1], R>;
14
- type Func3<T0 = any, T1 = any, T2 = any, R = any> = Callback<[T0, T1, T2], R>;
15
- type Func4<T0 = any, T1 = any, T2 = any, T3 = any, R = any> = Callback<[T0, T1, T2, T3], R>;
16
- type Result<T = any> = T | Promise<T>;
17
- }