@hairy/utils 0.6.5 → 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
@@ -1,4 +1,3 @@
1
- import { PipeFn, ComposeFn } from 'pipe-and-compose-types';
2
1
  export { default as pPipe } from 'p-pipe';
3
2
  export { default as delay } from 'delay';
4
3
 
@@ -31,14 +30,25 @@ declare function isFormData(value: any): value is FormData;
31
30
  declare function isWindow(value: any): value is Window;
32
31
  declare function isObject(value: any): value is object;
33
32
 
34
- interface AtWillObject {
33
+ type AtwillNumber = string | number;
34
+ type AtwillObject = {
35
35
  [key: string]: any;
36
- }
37
- type AtWillNumber = string | number;
38
- interface StringObject {
36
+ };
37
+ type AtwillNumberObject = {
38
+ [key: string]: AtwillNumber;
39
+ };
40
+ type StringObject = {
39
41
  [key: string]: string;
40
- }
42
+ };
43
+ type NumberObject = {
44
+ [key: string]: string;
45
+ };
46
+ type SymbolObject = {
47
+ [key: string]: symbol;
48
+ };
41
49
  type Key = string | number | symbol;
50
+ type BooleanLike = any;
51
+
42
52
  type DeepReadonly<T> = {
43
53
  readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P];
44
54
  };
@@ -48,23 +58,26 @@ type DeepRequired<T> = {
48
58
  type DeepPartial<T> = {
49
59
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
50
60
  };
51
- type DeepKeyof<T> = T extends object ? keyof T | DeepKeyof<T[keyof T]> : never;
52
61
  type DeepReplace<T, K = unknown, V = unknown> = {
53
62
  [P in keyof T]: K extends P ? V : DeepReplace<T[P], K, V>;
54
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[];
55
68
  type Option<L extends Key = 'label', V extends Key = 'value', C extends Key = 'children'> = {
56
69
  [P in L]?: string;
57
70
  } & {
58
- [P in V]?: AtWillNumber;
71
+ [P in V]?: AtwillNumber;
59
72
  } & {
60
73
  [P in C]?: Option<L, V, C>[];
61
74
  };
62
75
 
63
- declare function atWillToUnit(value: AtWillNumber, unit?: string): string;
76
+ declare function atWillToUnit(value: AtwillNumber, unit?: string): string;
64
77
  /** size 转换配置 */
65
- type AtWillSize = AtWillNumber | [AtWillNumber, AtWillNumber] | {
66
- width: AtWillNumber;
67
- height: AtWillNumber;
78
+ type AtWillSize = AtwillNumber | [AtwillNumber, AtwillNumber] | {
79
+ width: AtwillNumber;
80
+ height: AtwillNumber;
68
81
  };
69
82
  interface Size {
70
83
  width: string;
@@ -92,8 +105,8 @@ declare function getTypeof(target: any): TypeofType;
92
105
  */
93
106
  declare function isTypeof(target: any, type: TypeofType): boolean;
94
107
 
95
- declare const pipe: PipeFn;
96
- declare const compose: ComposeFn;
108
+ declare const pipe: (...fns: any[]) => any;
109
+ declare const compose: (...fns: any[]) => any;
97
110
  /**
98
111
  * 生成区间数组
99
112
  * arange(<start>, <stop>, [step=1], [target=[]], [at])
@@ -101,8 +114,8 @@ declare const compose: ComposeFn;
101
114
  declare function arange(x1: number, x2?: number, stp?: number, z?: number[], z0?: number): number[];
102
115
  type Deferred<T = void> = Promise<T> & {
103
116
  resolve: (value: T) => void;
104
- reject: Function;
117
+ reject: (value?: any) => void;
105
118
  };
106
119
  declare function createDeferred<T = void>(): Deferred<T>;
107
120
 
108
- export { AtWillNumber, AtWillObject, AtWillSize, DeepKeyof, DeepPartial, DeepReadonly, DeepReplace, DeepRequired, Deferred, Key, Option, Size, StringObject, 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 };
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.5",
3
+ "version": "0.6.8",
4
4
  "license": "MIT",
5
- "main": "./dist/index.cjs.js",
5
+ "main": "./dist/index.cjs",
6
6
  "publishConfig": {
7
7
  "jsdelivr": "./dist/index.iife.min.js"
8
8
  },
@@ -13,8 +13,7 @@
13
13
  "@extra-array/arange": "^1.1.7",
14
14
  "delay": "^5.0.0",
15
15
  "lodash": "^4",
16
- "p-pipe": "^4.0.0",
17
- "pipe-and-compose-types": "^0.0.13"
16
+ "p-pipe": "^4.0.0"
18
17
  },
19
18
  "devDependencies": {
20
19
  "@types/lodash": "^4"
@@ -22,14 +21,14 @@
22
21
  "scripts": {
23
22
  "build": "ptsup src/index.ts --dts"
24
23
  },
24
+ "module": "./dist/index.mjs",
25
25
  "types": "./dist/index.d.ts",
26
- "module": "./dist/index.esm.js",
27
26
  "unpkg": "./dist/index.iife.min.js",
28
27
  "exports": {
29
28
  ".": {
30
- "types": "./dist/index.d.ts",
31
- "import": "./dist/index.esm.js",
32
- "require": "./dist/index.cjs.js"
29
+ "import": "./dist/index.mjs",
30
+ "require": "./dist/index.cjs",
31
+ "types": "./dist/index.d.ts"
33
32
  },
34
33
  "./*": "./*"
35
34
  }
File without changes
File without changes