ddan-js 2.4.1 → 2.4.2
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/lib/modules/time/dtime.js +2 -2
- package/bin/types/index.d.ts +20 -20
- package/bin/types/modules/hook/debounce.d.ts +1 -2
- package/bin/types/modules/hook/throttle.d.ts +1 -2
- package/bin/types/modules/obj/index.d.ts +5 -5
- package/bin/types/modules/string/index.d.ts +2 -2
- package/bin/types/modules/time/dtime.d.ts +3 -19
- package/bin/types/modules/time/frame.d.ts +2 -1
- package/bin/types/modules/time/index.d.ts +1 -1
- package/bin/types/typings/index.d.ts +62 -16
- package/bin/types/util/index.d.ts +4 -4
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@ class DTime {
|
|
|
50
50
|
this.SSS = this.S.toString().padStart(3, "0");
|
|
51
51
|
return this;
|
|
52
52
|
}
|
|
53
|
-
toCountdown(
|
|
53
|
+
toCountdown(regFormat = "") {
|
|
54
54
|
const result = {
|
|
55
55
|
countdown: 0,
|
|
56
56
|
timestamp: 0,
|
|
@@ -89,7 +89,7 @@ class DTime {
|
|
|
89
89
|
result.S = amount;
|
|
90
90
|
result.SS = (result.S < 10 ? "0" : "") + result.S;
|
|
91
91
|
result.SSS = result.S.toString().padStart(3, "0");
|
|
92
|
-
let _reg =
|
|
92
|
+
let _reg = regFormat;
|
|
93
93
|
if (!_reg) {
|
|
94
94
|
if (result.countdown > const_1.default.oneHour) {
|
|
95
95
|
_reg = "hh:mm:ss";
|
package/bin/types/index.d.ts
CHANGED
|
@@ -11,17 +11,17 @@ declare const dUtil: {
|
|
|
11
11
|
fields?: string[] | undefined;
|
|
12
12
|
camel?: boolean | undefined;
|
|
13
13
|
pure?: boolean | undefined;
|
|
14
|
-
} & import("./typings").
|
|
14
|
+
} & import("./typings").Ddan.IIgnoreParams) => any;
|
|
15
15
|
clone: (source: any) => any;
|
|
16
|
-
merge: (target: any, source: any, options?: import("./typings").
|
|
16
|
+
merge: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
17
17
|
isEmpty: (source: any) => boolean;
|
|
18
18
|
parseValue: (source: any, { number, boolean }?: {
|
|
19
19
|
number?: boolean | undefined;
|
|
20
20
|
boolean?: boolean | undefined;
|
|
21
21
|
}) => any;
|
|
22
22
|
cloneClass: <T>(source: T) => T;
|
|
23
|
-
combine: (target: any, source: any, options?: import("./typings").
|
|
24
|
-
combines: (objs: any[], options?: import("./typings").
|
|
23
|
+
combine: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => any;
|
|
24
|
+
combines: (objs: any[], options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
25
25
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
26
26
|
getTag: (value: any) => string;
|
|
27
27
|
getType: (value: any) => string;
|
|
@@ -94,7 +94,7 @@ declare const dUtil: {
|
|
|
94
94
|
number?: boolean | undefined;
|
|
95
95
|
boolean?: boolean | undefined;
|
|
96
96
|
}) => any;
|
|
97
|
-
replace: (source: string, rules: import("./typings").
|
|
97
|
+
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
98
98
|
};
|
|
99
99
|
time: {
|
|
100
100
|
now: () => import("./modules/time/dtime").default;
|
|
@@ -109,7 +109,7 @@ declare const dUtil: {
|
|
|
109
109
|
}) => number;
|
|
110
110
|
todayZero: () => number;
|
|
111
111
|
format: (time: string | number | Date, reg?: string) => string;
|
|
112
|
-
countdown: (endTime: string | number | Date, reg?: string) => "" | import("./
|
|
112
|
+
countdown: (endTime: string | number | Date, reg?: string) => "" | import("./typings").Ddan.ICountdown;
|
|
113
113
|
dtime: (time: string | number | Date) => import("./modules/time/dtime").default;
|
|
114
114
|
loopFrame: (interval?: number) => import("./modules/time/frame").default;
|
|
115
115
|
oneDay: number;
|
|
@@ -122,17 +122,17 @@ declare const dUtil: {
|
|
|
122
122
|
fields?: string[] | undefined;
|
|
123
123
|
camel?: boolean | undefined;
|
|
124
124
|
pure?: boolean | undefined;
|
|
125
|
-
} & import("./typings").
|
|
125
|
+
} & import("./typings").Ddan.IIgnoreParams) => any;
|
|
126
126
|
clone: (source: any) => any;
|
|
127
|
-
merge: (target: any, source: any, options?: import("./typings").
|
|
127
|
+
merge: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
128
128
|
isEmpty: (source: any) => boolean;
|
|
129
129
|
parseValue: (source: any, { number, boolean }?: {
|
|
130
130
|
number?: boolean | undefined;
|
|
131
131
|
boolean?: boolean | undefined;
|
|
132
132
|
}) => any;
|
|
133
133
|
cloneClass: <T>(source: T) => T;
|
|
134
|
-
combine: (target: any, source: any, options?: import("./typings").
|
|
135
|
-
combines: (objs: any[], options?: import("./typings").
|
|
134
|
+
combine: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => any;
|
|
135
|
+
combines: (objs: any[], options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
136
136
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
137
137
|
};
|
|
138
138
|
crypto: {
|
|
@@ -424,7 +424,7 @@ declare const _default: {
|
|
|
424
424
|
}) => number;
|
|
425
425
|
todayZero: () => number;
|
|
426
426
|
format: (time: string | number | Date, reg?: string) => string;
|
|
427
|
-
countdown: (endTime: string | number | Date, reg?: string) => "" | import("./
|
|
427
|
+
countdown: (endTime: string | number | Date, reg?: string) => "" | import("./typings").Ddan.ICountdown;
|
|
428
428
|
dtime: (time: string | number | Date) => import("./modules/time/dtime").default;
|
|
429
429
|
loopFrame: (interval?: number) => import("./modules/time/frame").default;
|
|
430
430
|
oneDay: number;
|
|
@@ -475,17 +475,17 @@ declare const _default: {
|
|
|
475
475
|
fields?: string[] | undefined;
|
|
476
476
|
camel?: boolean | undefined;
|
|
477
477
|
pure?: boolean | undefined;
|
|
478
|
-
} & import("./typings").
|
|
478
|
+
} & import("./typings").Ddan.IIgnoreParams) => any;
|
|
479
479
|
clone: (source: any) => any;
|
|
480
|
-
merge: (target: any, source: any, options?: import("./typings").
|
|
480
|
+
merge: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
481
481
|
isEmpty: (source: any) => boolean;
|
|
482
482
|
parseValue: (source: any, { number, boolean }?: {
|
|
483
483
|
number?: boolean | undefined;
|
|
484
484
|
boolean?: boolean | undefined;
|
|
485
485
|
}) => any;
|
|
486
486
|
cloneClass: <T_3>(source: T_3) => T_3;
|
|
487
|
-
combine: (target: any, source: any, options?: import("./typings").
|
|
488
|
-
combines: (objs: any[], options?: import("./typings").
|
|
487
|
+
combine: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => any;
|
|
488
|
+
combines: (objs: any[], options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
489
489
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
490
490
|
getTag: (value: any) => string;
|
|
491
491
|
getType: (value: any) => string;
|
|
@@ -535,24 +535,24 @@ declare const _default: {
|
|
|
535
535
|
number?: boolean | undefined;
|
|
536
536
|
boolean?: boolean | undefined;
|
|
537
537
|
}) => any;
|
|
538
|
-
replace: (source: string, rules: import("./typings").
|
|
538
|
+
replace: (source: string, rules: import("./typings").Ddan.IRegexRule | import("./typings").Ddan.IRegexRule[]) => string;
|
|
539
539
|
};
|
|
540
540
|
obj: {
|
|
541
541
|
copy: (source: any, options?: {
|
|
542
542
|
fields?: string[] | undefined;
|
|
543
543
|
camel?: boolean | undefined;
|
|
544
544
|
pure?: boolean | undefined;
|
|
545
|
-
} & import("./typings").
|
|
545
|
+
} & import("./typings").Ddan.IIgnoreParams) => any;
|
|
546
546
|
clone: (source: any) => any;
|
|
547
|
-
merge: (target: any, source: any, options?: import("./typings").
|
|
547
|
+
merge: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
548
548
|
isEmpty: (source: any) => boolean;
|
|
549
549
|
parseValue: (source: any, { number, boolean }?: {
|
|
550
550
|
number?: boolean | undefined;
|
|
551
551
|
boolean?: boolean | undefined;
|
|
552
552
|
}) => any;
|
|
553
553
|
cloneClass: <T_3>(source: T_3) => T_3;
|
|
554
|
-
combine: (target: any, source: any, options?: import("./typings").
|
|
555
|
-
combines: (objs: any[], options?: import("./typings").
|
|
554
|
+
combine: (target: any, source: any, options?: import("./typings").Ddan.IIgnoreParams) => any;
|
|
555
|
+
combines: (objs: any[], options?: import("./typings").Ddan.IIgnoreParams) => {};
|
|
556
556
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
557
557
|
};
|
|
558
558
|
crypto: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { dd } from '../../typings';
|
|
2
1
|
import { Ddan } from '../../typings';
|
|
3
2
|
/**
|
|
4
3
|
* 防抖 一段时间内,规定时间间隔多次执行,回调触发一次
|
|
@@ -7,7 +6,7 @@ import { Ddan } from '../../typings';
|
|
|
7
6
|
* @param options 参数:leading 开始执行, trailing结束执行
|
|
8
7
|
* @returns
|
|
9
8
|
*/
|
|
10
|
-
declare function debounce(func: Ddan.Action, wait?: number, options?:
|
|
9
|
+
declare function debounce(func: Ddan.Action, wait?: number, options?: Ddan.IDebounceOption): {
|
|
11
10
|
(...debouncedArgs: any[]): any;
|
|
12
11
|
cancel: () => void;
|
|
13
12
|
flush: () => any;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { dd } from "../../typings";
|
|
2
1
|
import { Ddan } from "../../typings";
|
|
3
2
|
/**
|
|
4
3
|
* 节流 每个间隔内,触发一次
|
|
@@ -7,7 +6,7 @@ import { Ddan } from "../../typings";
|
|
|
7
6
|
* @param options 参数:leading 开始执行, trailing结束执行
|
|
8
7
|
* @returns
|
|
9
8
|
*/
|
|
10
|
-
declare function throttle(func: Ddan.Action, wait?: number, options?: Omit<
|
|
9
|
+
declare function throttle(func: Ddan.Action, wait?: number, options?: Omit<Ddan.IDebounceOption, 'maxWait'>): {
|
|
11
10
|
(...debouncedArgs: any[]): any;
|
|
12
11
|
cancel: () => void;
|
|
13
12
|
flush: () => any;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ddan } from '../../typings';
|
|
2
2
|
declare function cloneClass<T>(source: T): T;
|
|
3
3
|
declare const _default: {
|
|
4
4
|
copy: (source: any, options?: {
|
|
5
5
|
fields?: string[] | undefined;
|
|
6
6
|
camel?: boolean | undefined;
|
|
7
7
|
pure?: boolean | undefined;
|
|
8
|
-
} &
|
|
8
|
+
} & Ddan.IIgnoreParams) => any;
|
|
9
9
|
clone: (source: any) => any;
|
|
10
|
-
merge: (target: any, source: any, options?:
|
|
10
|
+
merge: (target: any, source: any, options?: Ddan.IIgnoreParams) => {};
|
|
11
11
|
isEmpty: (source: any) => boolean;
|
|
12
12
|
parseValue: (source: any, { number, boolean }?: {
|
|
13
13
|
number?: boolean | undefined;
|
|
14
14
|
boolean?: boolean | undefined;
|
|
15
15
|
}) => any;
|
|
16
16
|
cloneClass: typeof cloneClass;
|
|
17
|
-
combine: (target: any, source: any, options?:
|
|
18
|
-
combines: (objs: any[], options?:
|
|
17
|
+
combine: (target: any, source: any, options?: Ddan.IIgnoreParams) => any;
|
|
18
|
+
combines: (objs: any[], options?: Ddan.IIgnoreParams) => {};
|
|
19
19
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
20
20
|
};
|
|
21
21
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ddan } from "../../typings";
|
|
2
2
|
declare function toString(value: any): any;
|
|
3
3
|
declare const _default: {
|
|
4
4
|
toString: typeof toString;
|
|
@@ -15,6 +15,6 @@ declare const _default: {
|
|
|
15
15
|
number?: boolean | undefined;
|
|
16
16
|
boolean?: boolean | undefined;
|
|
17
17
|
}) => any;
|
|
18
|
-
replace: (source: string, rules:
|
|
18
|
+
replace: (source: string, rules: Ddan.IRegexRule | Ddan.IRegexRule[]) => string;
|
|
19
19
|
};
|
|
20
20
|
export default _default;
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
timestamp: number;
|
|
4
|
-
seconds: number;
|
|
5
|
-
d: number;
|
|
6
|
-
dd: string;
|
|
7
|
-
h: number;
|
|
8
|
-
hh: string;
|
|
9
|
-
m: number;
|
|
10
|
-
mm: string;
|
|
11
|
-
s: number;
|
|
12
|
-
ss: string;
|
|
13
|
-
S: number;
|
|
14
|
-
SS: string;
|
|
15
|
-
SSS: string;
|
|
16
|
-
desc: string;
|
|
17
|
-
}
|
|
18
|
-
export default class DTime {
|
|
1
|
+
import { Ddan } from "../../typings";
|
|
2
|
+
export default class DTime implements Ddan.ITime {
|
|
19
3
|
date?: Date;
|
|
20
4
|
timestamp: number;
|
|
21
5
|
yyyy?: number;
|
|
@@ -35,7 +19,7 @@ export default class DTime {
|
|
|
35
19
|
SSS: string;
|
|
36
20
|
constructor(time: string | number | Date);
|
|
37
21
|
toDate(): this;
|
|
38
|
-
toCountdown(
|
|
22
|
+
toCountdown(regFormat?: string): Ddan.ICountdown;
|
|
39
23
|
add(ms?: number): this;
|
|
40
24
|
format(reg?: string): string;
|
|
41
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import DEvent from "../../class/event";
|
|
3
|
-
|
|
3
|
+
import { Ddan } from "../../typings";
|
|
4
|
+
export default class DLoopFrame implements Ddan.ILoopFrame {
|
|
4
5
|
_loopTimer: string | number | NodeJS.Timeout | undefined;
|
|
5
6
|
_event: DEvent;
|
|
6
7
|
started: boolean;
|
|
@@ -24,7 +24,7 @@ declare const _default: {
|
|
|
24
24
|
parseTimestamp: typeof parseTimestamp;
|
|
25
25
|
todayZero: () => number;
|
|
26
26
|
format: (time: string | number | Date, reg?: string) => string;
|
|
27
|
-
countdown: (endTime: string | number | Date, reg?: string) => "" | import("
|
|
27
|
+
countdown: (endTime: string | number | Date, reg?: string) => "" | import("../..").Ddan.ICountdown;
|
|
28
28
|
dtime: (time: string | number | Date) => DTime;
|
|
29
29
|
loopFrame: (interval?: number) => LoopFrame;
|
|
30
30
|
oneDay: number;
|
|
@@ -60,9 +60,66 @@ export declare namespace Ddan {
|
|
|
60
60
|
type TStoreActionFunction = (arg: IDStore & {
|
|
61
61
|
commit: TStoreCommitFunction;
|
|
62
62
|
}, payload: any) => any;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
interface ILoopFrame {
|
|
64
|
+
start: () => ILoopFrame;
|
|
65
|
+
stop: () => ILoopFrame;
|
|
66
|
+
restart: () => ILoopFrame;
|
|
67
|
+
on: (cb: Function) => ILoopFrame;
|
|
68
|
+
off: (cb: Function) => ILoopFrame;
|
|
69
|
+
}
|
|
70
|
+
interface ICountdown {
|
|
71
|
+
countdown: number;
|
|
72
|
+
timestamp: number;
|
|
73
|
+
seconds: number;
|
|
74
|
+
d: number;
|
|
75
|
+
dd: string;
|
|
76
|
+
h: number;
|
|
77
|
+
hh: string;
|
|
78
|
+
m: number;
|
|
79
|
+
mm: string;
|
|
80
|
+
s: number;
|
|
81
|
+
ss: string;
|
|
82
|
+
S: number;
|
|
83
|
+
SS: string;
|
|
84
|
+
SSS: string;
|
|
85
|
+
desc: string;
|
|
86
|
+
}
|
|
87
|
+
interface ITime {
|
|
88
|
+
date?: Date;
|
|
89
|
+
timestamp: number;
|
|
90
|
+
yyyy?: number;
|
|
91
|
+
yy?: string;
|
|
92
|
+
M?: number;
|
|
93
|
+
MM?: string;
|
|
94
|
+
d: number;
|
|
95
|
+
dd: string;
|
|
96
|
+
h: number;
|
|
97
|
+
hh: string;
|
|
98
|
+
m: number;
|
|
99
|
+
mm: string;
|
|
100
|
+
s: number;
|
|
101
|
+
ss: string;
|
|
102
|
+
S: number;
|
|
103
|
+
SS: string;
|
|
104
|
+
SSS: string;
|
|
105
|
+
toDate: () => ITime;
|
|
106
|
+
toCountdown: (regFormat?: string) => Ddan.ICountdown;
|
|
107
|
+
add: (ms: number) => ITime;
|
|
108
|
+
format: (regFormat?: string) => string;
|
|
109
|
+
}
|
|
110
|
+
interface IRegexRule {
|
|
111
|
+
key: string;
|
|
112
|
+
flag?: "i" | "g" | "m" | "gi" | "mi";
|
|
113
|
+
value: string;
|
|
114
|
+
}
|
|
115
|
+
interface IIgnoreParams {
|
|
116
|
+
ignoreUndefined?: boolean;
|
|
117
|
+
ignoreNull?: boolean;
|
|
118
|
+
ignoreZero?: boolean;
|
|
119
|
+
ignoreEmptyArray?: boolean;
|
|
120
|
+
ignoreEmptyString?: boolean;
|
|
121
|
+
cover?: boolean;
|
|
122
|
+
}
|
|
66
123
|
/**
|
|
67
124
|
* leading 开始执行
|
|
68
125
|
* trailing 结束执行
|
|
@@ -72,6 +129,8 @@ export declare namespace dd {
|
|
|
72
129
|
maxWait?: number;
|
|
73
130
|
trailing?: boolean;
|
|
74
131
|
}
|
|
132
|
+
}
|
|
133
|
+
export declare namespace dd {
|
|
75
134
|
interface IHttpRequest {
|
|
76
135
|
url: string;
|
|
77
136
|
host: string;
|
|
@@ -138,17 +197,4 @@ export declare namespace dd {
|
|
|
138
197
|
padx?: number;
|
|
139
198
|
pady?: number;
|
|
140
199
|
}
|
|
141
|
-
interface IRegexRule {
|
|
142
|
-
key: string;
|
|
143
|
-
flag?: "i" | "g" | "m" | "gi" | "mi";
|
|
144
|
-
value: string;
|
|
145
|
-
}
|
|
146
|
-
interface IIgnoreParams {
|
|
147
|
-
ignoreUndefined?: boolean;
|
|
148
|
-
ignoreNull?: boolean;
|
|
149
|
-
ignoreZero?: boolean;
|
|
150
|
-
ignoreEmptyArray?: boolean;
|
|
151
|
-
ignoreEmptyString?: boolean;
|
|
152
|
-
cover?: boolean;
|
|
153
|
-
}
|
|
154
200
|
}
|
|
@@ -6,17 +6,17 @@ declare const _default: {
|
|
|
6
6
|
fields?: string[] | undefined;
|
|
7
7
|
camel?: boolean | undefined;
|
|
8
8
|
pure?: boolean | undefined;
|
|
9
|
-
} & import("
|
|
9
|
+
} & import("..").Ddan.IIgnoreParams) => any;
|
|
10
10
|
clone: (source: any) => any;
|
|
11
|
-
merge: (target: any, source: any, options?: import("
|
|
11
|
+
merge: (target: any, source: any, options?: import("..").Ddan.IIgnoreParams) => {};
|
|
12
12
|
isEmpty: (source: any) => boolean;
|
|
13
13
|
parseValue: (source: any, { number, boolean }?: {
|
|
14
14
|
number?: boolean | undefined;
|
|
15
15
|
boolean?: boolean | undefined;
|
|
16
16
|
}) => any;
|
|
17
17
|
cloneClass: <T>(source: T) => T;
|
|
18
|
-
combine: (target: any, source: any, options?: import("
|
|
19
|
-
combines: (objs: any[], options?: import("
|
|
18
|
+
combine: (target: any, source: any, options?: import("..").Ddan.IIgnoreParams) => any;
|
|
19
|
+
combines: (objs: any[], options?: import("..").Ddan.IIgnoreParams) => {};
|
|
20
20
|
observe: (obj: any, key: any, watchFun: any, owner: any, deep?: boolean) => void;
|
|
21
21
|
getTag: (value: any) => string;
|
|
22
22
|
getType: (value: any) => string;
|