lgutils 1.3.51 → 1.3.52
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/index.d.ts +60 -99
- package/lib/lgutils.cjs.js +179 -77
- package/lib/lgutils.cjs.prod.js +1 -1
- package/lib/lgutils.esm-bundler.js +178 -77
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { parse } from 'qs'
|
|
2
|
-
import { stringify } from 'qs'
|
|
3
|
-
|
|
4
1
|
export declare function accAdd(a: number | string, b: number | string): number
|
|
5
2
|
|
|
6
|
-
export declare const accDiv: (arg1: number, arg2: number) => number
|
|
3
|
+
export declare const accDiv: (arg1: number, arg2: number) => number | undefined
|
|
7
4
|
|
|
8
|
-
export declare const accMul: (arg1: number, arg2: number) => number
|
|
5
|
+
export declare const accMul: (arg1: number, arg2: number) => number | undefined
|
|
9
6
|
|
|
10
|
-
export declare const accSub: (arg1: number, arg2: number) => string
|
|
7
|
+
export declare const accSub: (arg1: number, arg2: number) => string | undefined
|
|
11
8
|
|
|
12
9
|
export declare function copyToClipboard(txt: string): void
|
|
13
10
|
|
|
14
|
-
export declare const cutTimeFn: (n: number) => string
|
|
11
|
+
export declare const cutTimeFn: (n: number) => string | undefined
|
|
15
12
|
|
|
16
|
-
export declare const DATE_FORMAT
|
|
13
|
+
export declare const DATE_FORMAT: string
|
|
17
14
|
|
|
18
|
-
export declare function digitCnUppercase(n: number): string
|
|
15
|
+
export declare function digitCnUppercase(n: number): string | undefined
|
|
19
16
|
|
|
20
17
|
export declare function disableBrowserZoom(): void
|
|
21
18
|
|
|
@@ -30,59 +27,33 @@ export declare const fileReaderToBase64: (target: any) => (cb: (p: any) => void)
|
|
|
30
27
|
|
|
31
28
|
export declare const filterNil: (obj: AnyObj) => AnyObj
|
|
32
29
|
|
|
33
|
-
export declare const format10k: (n: number) =>
|
|
30
|
+
export declare const format10k: (n: number) => any
|
|
34
31
|
|
|
35
|
-
export declare const format10kNil: (d: number | NIL) =>
|
|
32
|
+
export declare const format10kNil: (d: number | NIL) => any
|
|
36
33
|
|
|
37
|
-
export declare const FORMAT_DATE
|
|
34
|
+
export declare const FORMAT_DATE: string
|
|
38
35
|
|
|
39
|
-
export declare const FORMAT_TIME
|
|
36
|
+
export declare const FORMAT_TIME: string
|
|
40
37
|
|
|
41
|
-
export declare const formatBillion: (num: number) => string
|
|
38
|
+
export declare const formatBillion: (num: number) => string | undefined
|
|
42
39
|
|
|
43
|
-
export declare const formatCash:
|
|
44
|
-
n:
|
|
45
|
-
| number
|
|
46
|
-
| {
|
|
47
|
-
valueOf(): number
|
|
48
|
-
},
|
|
49
|
-
) => string
|
|
40
|
+
export declare const formatCash: any
|
|
50
41
|
|
|
51
|
-
export declare const formatCash2: (num: number) => string
|
|
42
|
+
export declare const formatCash2: (num: number) => string | undefined
|
|
52
43
|
|
|
53
|
-
export declare const formatCashInt:
|
|
54
|
-
n:
|
|
55
|
-
| number
|
|
56
|
-
| {
|
|
57
|
-
valueOf(): number
|
|
58
|
-
},
|
|
59
|
-
) => string
|
|
44
|
+
export declare const formatCashInt: any
|
|
60
45
|
|
|
61
|
-
export declare const formatCashIntNil: (
|
|
62
|
-
d:
|
|
63
|
-
| number
|
|
64
|
-
| {
|
|
65
|
-
valueOf(): number
|
|
66
|
-
}
|
|
67
|
-
| NIL,
|
|
68
|
-
) => string
|
|
46
|
+
export declare const formatCashIntNil: (d: unknown) => any
|
|
69
47
|
|
|
70
|
-
export declare const formatCashNil: (
|
|
71
|
-
d:
|
|
72
|
-
| number
|
|
73
|
-
| {
|
|
74
|
-
valueOf(): number
|
|
75
|
-
}
|
|
76
|
-
| NIL,
|
|
77
|
-
) => string
|
|
48
|
+
export declare const formatCashNil: (d: unknown) => any
|
|
78
49
|
|
|
79
|
-
export declare function formatDate(d: string | number, formatType?: string): string
|
|
50
|
+
export declare function formatDate(d: string | number, formatType?: string): string | undefined
|
|
80
51
|
|
|
81
|
-
export declare const formatDateNil: (d: string | number | null | undefined) =>
|
|
52
|
+
export declare const formatDateNil: (d: string | number | null | undefined) => any
|
|
82
53
|
|
|
83
|
-
export declare function formatDuration(period: string): string
|
|
54
|
+
export declare function formatDuration(period: string): string | undefined
|
|
84
55
|
|
|
85
|
-
export declare const formatDurationNil: (d: string | null | undefined) =>
|
|
56
|
+
export declare const formatDurationNil: (d: string | null | undefined) => any
|
|
86
57
|
|
|
87
58
|
/**
|
|
88
59
|
* 金额格式化为万元,带千分位,最多保留6位小数
|
|
@@ -99,72 +70,61 @@ export declare function formatNumWithUnit(
|
|
|
99
70
|
type?: number,
|
|
100
71
|
): string | undefined
|
|
101
72
|
|
|
102
|
-
export declare const formatRatio:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
) => string
|
|
109
|
-
|
|
110
|
-
export declare const formatRatioNil: (
|
|
111
|
-
d:
|
|
112
|
-
| number
|
|
113
|
-
| {
|
|
114
|
-
valueOf(): number
|
|
115
|
-
}
|
|
116
|
-
| NIL,
|
|
117
|
-
) => string
|
|
118
|
-
|
|
119
|
-
export declare const getBase64: (file: File) => Promise<unknown>
|
|
73
|
+
export declare const formatRatio: any
|
|
74
|
+
|
|
75
|
+
export declare const formatRatioNil: (d: unknown) => any
|
|
76
|
+
|
|
77
|
+
export declare const getBase64: (file: File) => Promise<unknown> | undefined
|
|
120
78
|
|
|
121
79
|
export declare const getItem: (key: string) => any
|
|
122
80
|
|
|
123
81
|
export declare const getQueryObject: (url?: string) => any
|
|
124
82
|
|
|
125
|
-
export declare const getSearchParams: (search: string) => URLSearchParams
|
|
83
|
+
export declare const getSearchParams: (search: string) => URLSearchParams | undefined
|
|
126
84
|
|
|
127
|
-
export declare const getValOfArr: (_array: number[]) =>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
85
|
+
export declare const getValOfArr: (_array: number[]) =>
|
|
86
|
+
| {
|
|
87
|
+
min: any
|
|
88
|
+
max: any
|
|
89
|
+
sum: number
|
|
90
|
+
average: number
|
|
91
|
+
mull: number
|
|
92
|
+
}
|
|
93
|
+
| undefined
|
|
134
94
|
|
|
135
95
|
export declare const getValueWithNil: (val: any) => any
|
|
136
96
|
|
|
137
97
|
export declare const inBrowser: boolean
|
|
138
98
|
|
|
139
|
-
export declare const isArray: (value: any) => boolean
|
|
99
|
+
export declare const isArray: (value: any) => boolean | undefined
|
|
140
100
|
|
|
141
101
|
export declare const isBlob: (value: any) => any
|
|
142
102
|
|
|
143
|
-
export declare const isCardNo: (cardNum: any) => boolean
|
|
103
|
+
export declare const isCardNo: (cardNum: any) => boolean | undefined
|
|
144
104
|
|
|
145
105
|
export declare const isDate: (value: string) => boolean
|
|
146
106
|
|
|
147
|
-
export declare const isEmail: (emailStr: string) => boolean
|
|
107
|
+
export declare const isEmail: (emailStr: string) => boolean | undefined
|
|
148
108
|
|
|
149
109
|
export declare const isFile: (value: any) => any
|
|
150
110
|
|
|
151
|
-
export declare const isMinigram: () => boolean
|
|
111
|
+
export declare const isMinigram: () => boolean | undefined
|
|
152
112
|
|
|
153
113
|
export declare const isNil: (val: any) => val is NIL
|
|
154
114
|
|
|
155
|
-
export declare const isNull: (value: any) => boolean
|
|
115
|
+
export declare const isNull: (value: any) => boolean | undefined
|
|
156
116
|
|
|
157
117
|
export declare const isNumber: (a: number | string) => boolean
|
|
158
118
|
|
|
159
|
-
export declare const isObject: (value: any) => boolean
|
|
119
|
+
export declare const isObject: (value: any) => boolean | undefined
|
|
160
120
|
|
|
161
|
-
export declare const isPhone: (phone: any) => boolean
|
|
121
|
+
export declare const isPhone: (phone: any) => boolean | undefined
|
|
162
122
|
|
|
163
123
|
export declare const isSMSCode: (code: any) => any
|
|
164
124
|
|
|
165
|
-
export declare const isUndefined: (value: any) => boolean
|
|
125
|
+
export declare const isUndefined: (value: any) => boolean | undefined
|
|
166
126
|
|
|
167
|
-
export declare const isWX: () => boolean
|
|
127
|
+
export declare const isWX: () => boolean | undefined
|
|
168
128
|
|
|
169
129
|
declare interface IWSObj {
|
|
170
130
|
open?: (params?: any) => any
|
|
@@ -177,11 +137,11 @@ declare interface IWSObj {
|
|
|
177
137
|
|
|
178
138
|
export declare const log: (...rest: any) => void
|
|
179
139
|
|
|
180
|
-
export declare const loopData: (arr: any[], childkey?: string) => any[]
|
|
140
|
+
export declare const loopData: (arr: any[], childkey?: string) => any[] | undefined
|
|
181
141
|
|
|
182
142
|
declare type NIL = undefined | null | ''
|
|
183
143
|
|
|
184
|
-
export declare const NIL_STRING
|
|
144
|
+
export declare const NIL_STRING: string
|
|
185
145
|
|
|
186
146
|
export declare const os: () => {
|
|
187
147
|
isTablet: boolean
|
|
@@ -192,15 +152,15 @@ export declare const os: () => {
|
|
|
192
152
|
isIos: boolean
|
|
193
153
|
}
|
|
194
154
|
|
|
195
|
-
export
|
|
155
|
+
export declare const parse: any
|
|
196
156
|
|
|
197
157
|
export declare const playAudio: (mp3Id: string) => void
|
|
198
158
|
|
|
199
|
-
export declare const random: (min: number, max: number) => number
|
|
159
|
+
export declare const random: (min: number, max: number) => number | undefined
|
|
200
160
|
|
|
201
|
-
export declare const randomString: (len?: number) => string
|
|
161
|
+
export declare const randomString: (len?: number) => string | undefined
|
|
202
162
|
|
|
203
|
-
export declare const randomWithCrypto: () => string
|
|
163
|
+
export declare const randomWithCrypto: () => string | undefined
|
|
204
164
|
|
|
205
165
|
export declare const removeAll: () => any
|
|
206
166
|
|
|
@@ -208,12 +168,13 @@ export declare const removeItem: (key: string) => any
|
|
|
208
168
|
|
|
209
169
|
export declare const setItem: (key: string, value: any) => any
|
|
210
170
|
|
|
211
|
-
export declare const setProxyObj: (
|
|
171
|
+
export declare const setProxyObj: (
|
|
172
|
+
data: object,
|
|
173
|
+
getFn: () => void,
|
|
174
|
+
setFn: () => void,
|
|
175
|
+
) => object | undefined
|
|
212
176
|
|
|
213
|
-
export declare const sOptions:
|
|
214
|
-
key: number
|
|
215
|
-
value: number
|
|
216
|
-
}[]
|
|
177
|
+
export declare const sOptions: any
|
|
217
178
|
|
|
218
179
|
export declare const sortObj: <
|
|
219
180
|
T extends keyof D,
|
|
@@ -224,9 +185,9 @@ export declare const sortObj: <
|
|
|
224
185
|
obj: D[],
|
|
225
186
|
property: T,
|
|
226
187
|
type?: 'asc' | 'desc',
|
|
227
|
-
) => D[]
|
|
188
|
+
) => D[] | undefined
|
|
228
189
|
|
|
229
|
-
export
|
|
190
|
+
export declare const stringify: any
|
|
230
191
|
|
|
231
192
|
export declare const sumObj: <
|
|
232
193
|
T extends keyof D,
|
|
@@ -236,9 +197,9 @@ export declare const sumObj: <
|
|
|
236
197
|
>(
|
|
237
198
|
obj: D[],
|
|
238
199
|
key: T,
|
|
239
|
-
) => number
|
|
200
|
+
) => number | undefined
|
|
240
201
|
|
|
241
|
-
export declare const trimString: (str: string) => string
|
|
202
|
+
export declare const trimString: (str: string) => string | undefined
|
|
242
203
|
|
|
243
204
|
export declare class WS {
|
|
244
205
|
socket: any
|