super-toolkit 1.0.1 → 1.0.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/index.d.ts +1 -63
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,68 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
type Format='YYYY/MM/DD HH:MM:SS' | 'YYYY-MM-DD HH:MM:SS' | 'YYYY/MM/DD' | 'YYYY-MM-DD' | 'MM/DD' | 'MM-DD' | 'MM' | 'DD'
|
|
3
|
-
|
|
4
|
-
/** 数组去重 */
|
|
5
|
-
unique:<T>(oldArr: Record<string, any>[], key?: string) => T,
|
|
6
|
-
/** 数组升序排序 */
|
|
7
|
-
minSort:<T extends Record<string, any>[] | (string | number)[]>(arr: T, key: string) => T,
|
|
8
|
-
/** 数组降序排序 */
|
|
9
|
-
maxSort:<T extends Record<string, any>[] | (string | number)[]>(arr: T, key: string) => T,
|
|
10
|
-
|
|
11
|
-
/** 获取指定长度的随机数 */
|
|
12
|
-
getRandomSixNum:(size: number) => string,
|
|
13
|
-
/** 深克隆 */
|
|
14
|
-
deepClone:<T>(val: T) => T,
|
|
15
|
-
|
|
16
|
-
/** 获取指定节点内容 */
|
|
17
|
-
getElementContent:(msg: string, el: string) => string | null,
|
|
18
|
-
|
|
19
|
-
/** 防抖 */
|
|
20
|
-
debounce:(fn: Function, wait: number) => never,
|
|
21
|
-
/** 节流 */
|
|
22
|
-
throttle:(fn: Function, wait: number) => (this: Window) => never,
|
|
23
|
-
|
|
24
|
-
/** 根据url获取指定的application类型 */
|
|
25
|
-
getApplication:(url: string) => string | null,
|
|
26
|
-
/** file转base64 */
|
|
27
|
-
fileToBase64: (file: File | Blob) => Promise<string>,
|
|
28
|
-
/** base64转blob */
|
|
29
|
-
base64ToBlob:(dataURL: string, mimeType?: string) => Blob,
|
|
30
|
-
/** blob转File */
|
|
31
|
-
blobToFile: (blob: Blob, fileName: string, mimeType: string) => File,
|
|
32
|
-
/** base64转file */
|
|
33
|
-
base64ToFile:(dataURL: string, fileName: string, mimeType?: string) => File,
|
|
34
|
-
|
|
35
|
-
/** 获取浏览器localStorage的数据 */
|
|
36
|
-
getLocalStorage:<T>(key: string) => T | null,
|
|
37
|
-
/** 设置浏览器localStorage的数据 */
|
|
38
|
-
setLocalStorage:<T = any>(key: string, value: T) => never,
|
|
39
|
-
|
|
40
|
-
/** 验证整数 */
|
|
41
|
-
validateInt:(value: string) => boolean,
|
|
42
|
-
/** 验证正整数 */
|
|
43
|
-
validateRightInt:(value: string) => boolean,
|
|
44
|
-
/** 验证负整数 */
|
|
45
|
-
alidateLeftInt:(value: string) => boolean,
|
|
46
|
-
/** 验证手机号 */
|
|
47
|
-
validatePhone:(value: string) => boolean,
|
|
48
|
-
/** 验证整数 */
|
|
49
|
-
validateIDCard:(value: string) => boolean,
|
|
50
|
-
/** 验证邮箱地址 */
|
|
51
|
-
validateEmail:(value: string) => boolean,
|
|
52
|
-
/** 验证金额 */
|
|
53
|
-
validateAmount:(value: string) => boolean,
|
|
54
|
-
/** 验证邮政编码 */
|
|
55
|
-
validatePostCode:(value: string) => boolean,
|
|
56
|
-
|
|
57
|
-
/** 获取指定格式的时间 */
|
|
58
|
-
getDate:(date: string | Date, format: Format, day?: number) => string,
|
|
59
|
-
/** 获取当月指定周数的开始时间与结束时间 */
|
|
60
|
-
getMonday:(type: "s" | "e", start?: number | undefined) => string,
|
|
61
|
-
/** 获取时间对应的星期几 */
|
|
62
|
-
getWeek:(date: string | Date) => string
|
|
63
|
-
}
|
|
64
|
-
declare const superToolkit:SuperToolkit
|
|
65
|
-
declare module "superToolkit" {
|
|
3
|
+
declare module "super-toolkit" {
|
|
66
4
|
/** 数组去重 */
|
|
67
5
|
export const unique:<T>(oldArr: Record<string, any>[], key?: string) => T
|
|
68
6
|
/** 数组升序排序 */
|