@hairy/utils 0.6.6 → 0.6.8
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/dist/index.d.ts
CHANGED
|
@@ -30,14 +30,25 @@ declare function isFormData(value: any): value is FormData;
|
|
|
30
30
|
declare function isWindow(value: any): value is Window;
|
|
31
31
|
declare function isObject(value: any): value is object;
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
type AtwillNumber = string | number;
|
|
34
|
+
type AtwillObject = {
|
|
34
35
|
[key: string]: any;
|
|
35
|
-
}
|
|
36
|
-
type
|
|
37
|
-
|
|
36
|
+
};
|
|
37
|
+
type AtwillNumberObject = {
|
|
38
|
+
[key: string]: AtwillNumber;
|
|
39
|
+
};
|
|
40
|
+
type StringObject = {
|
|
38
41
|
[key: string]: string;
|
|
39
|
-
}
|
|
42
|
+
};
|
|
43
|
+
type NumberObject = {
|
|
44
|
+
[key: string]: string;
|
|
45
|
+
};
|
|
46
|
+
type SymbolObject = {
|
|
47
|
+
[key: string]: symbol;
|
|
48
|
+
};
|
|
40
49
|
type Key = string | number | symbol;
|
|
50
|
+
type BooleanLike = any;
|
|
51
|
+
|
|
41
52
|
type DeepReadonly<T> = {
|
|
42
53
|
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
|
|
43
54
|
};
|
|
@@ -47,23 +58,26 @@ type DeepRequired<T> = {
|
|
|
47
58
|
type DeepPartial<T> = {
|
|
48
59
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
49
60
|
};
|
|
50
|
-
type DeepKeyof<T> = T extends object ? keyof T | DeepKeyof<T[keyof T]> : never;
|
|
51
61
|
type DeepReplace<T, K = unknown, V = unknown> = {
|
|
52
62
|
[P in keyof T]: K extends P ? V : DeepReplace<T[P], K, V>;
|
|
53
63
|
};
|
|
64
|
+
type DeepKeyof<T> = T extends object ? keyof T | DeepKeyof<T[keyof T]> : never;
|
|
65
|
+
|
|
66
|
+
type Awaitable<T> = T | Promise<T>;
|
|
67
|
+
type Arrayable<T> = T | T[];
|
|
54
68
|
type Option<L extends Key = 'label', V extends Key = 'value', C extends Key = 'children'> = {
|
|
55
69
|
[P in L]?: string;
|
|
56
70
|
} & {
|
|
57
|
-
[P in V]?:
|
|
71
|
+
[P in V]?: AtwillNumber;
|
|
58
72
|
} & {
|
|
59
73
|
[P in C]?: Option<L, V, C>[];
|
|
60
74
|
};
|
|
61
75
|
|
|
62
|
-
declare function atWillToUnit(value:
|
|
76
|
+
declare function atWillToUnit(value: AtwillNumber, unit?: string): string;
|
|
63
77
|
/** size 转换配置 */
|
|
64
|
-
type AtWillSize =
|
|
65
|
-
width:
|
|
66
|
-
height:
|
|
78
|
+
type AtWillSize = AtwillNumber | [AtwillNumber, AtwillNumber] | {
|
|
79
|
+
width: AtwillNumber;
|
|
80
|
+
height: AtwillNumber;
|
|
67
81
|
};
|
|
68
82
|
interface Size {
|
|
69
83
|
width: string;
|
|
@@ -100,8 +114,8 @@ declare const compose: (...fns: any[]) => any;
|
|
|
100
114
|
declare function arange(x1: number, x2?: number, stp?: number, z?: number[], z0?: number): number[];
|
|
101
115
|
type Deferred<T = void> = Promise<T> & {
|
|
102
116
|
resolve: (value: T) => void;
|
|
103
|
-
reject:
|
|
117
|
+
reject: (value?: any) => void;
|
|
104
118
|
};
|
|
105
119
|
declare function createDeferred<T = void>(): Deferred<T>;
|
|
106
120
|
|
|
107
|
-
export {
|
|
121
|
+
export { Arrayable, AtWillSize, AtwillNumber, AtwillNumberObject, AtwillObject, Awaitable, BooleanLike, DeepKeyof, DeepPartial, DeepReadonly, DeepReplace, DeepRequired, Deferred, Key, NumberObject, Option, Size, StringObject, SymbolObject, TypeofType, UA, arange, atWillToSize, atWillToUnit, compose, createDeferred, formDataToObject, getTypeof, isAndroid, isBrowser, isChrome, isEdge, isFF, isFormData, isIE, isIE11, isIE9, isIOS, isMobile, isObject, isPhantomJS, isTypeof, isWeex, isWindow, objectToFormData, pipe, weexPlatform };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/utils",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"main": "./dist/index.cjs
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"jsdelivr": "./dist/index.iife.min.js"
|
|
8
8
|
},
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "ptsup src/index.ts --dts"
|
|
23
23
|
},
|
|
24
|
+
"module": "./dist/index.mjs",
|
|
24
25
|
"types": "./dist/index.d.ts",
|
|
25
|
-
"module": "./dist/index.esm.js",
|
|
26
26
|
"unpkg": "./dist/index.iife.min.js",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
29
|
+
"import": "./dist/index.mjs",
|
|
30
|
+
"require": "./dist/index.cjs",
|
|
31
|
+
"types": "./dist/index.d.ts"
|
|
32
32
|
},
|
|
33
33
|
"./*": "./*"
|
|
34
34
|
}
|
|
File without changes
|
|
File without changes
|