@aomex/internal-tools 0.0.27 → 1.0.1
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/CHANGELOG.md +5 -3
- package/LICENSE +1 -1
- package/README.md +29 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# @aomex/internal-tools
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.0.1
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 1.0.0
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- [`11103a2`](https://github.com/aomex/aomex/commit/11103a2aff4e081754c56b0ff18fa5130ca252e8) Thanks [@geekact](https://github.com/geekact)! - 重新制作
|
package/LICENSE
CHANGED
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @aomex/internal-tools
|
|
2
|
+
|
|
3
|
+
内部实用工具库,包含以下内容:
|
|
4
|
+
|
|
5
|
+
## chalk
|
|
6
|
+
|
|
7
|
+
第三方库,用于在终端给文字添加颜色和背景
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
|
|
11
|
+
bytes 第三方库,字符串和字节数互相转换
|
|
12
|
+
|
|
13
|
+
## sleep
|
|
14
|
+
|
|
15
|
+
异步延迟执行
|
|
16
|
+
|
|
17
|
+
## toArray
|
|
18
|
+
|
|
19
|
+
强制把数据转换为数组
|
|
20
|
+
|
|
21
|
+
## 类型
|
|
22
|
+
|
|
23
|
+
### NonReadonly
|
|
24
|
+
|
|
25
|
+
取消readonly
|
|
26
|
+
|
|
27
|
+
### Union2Intersection
|
|
28
|
+
|
|
29
|
+
| 转换为 &
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare function toArray<T>(data: T | readonly T[], unique?: boolean): T[];
|
|
|
10
10
|
declare function toArray<T>(data: T | T[], unique?: boolean): T[];
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 等待指定的时间(毫秒)后再往下执行
|
|
14
14
|
*/
|
|
15
15
|
declare const sleep: (durationMS: number) => Promise<void>;
|
|
16
16
|
|
|
@@ -18,5 +18,8 @@ type NonReadonly<T extends object> = {
|
|
|
18
18
|
-readonly [K in keyof T]: T[K];
|
|
19
19
|
};
|
|
20
20
|
type Union2Intersection<T> = (T extends any ? (arg: T) => void : never) extends (arg: infer P) => void ? P : never;
|
|
21
|
+
type Prettify<T> = {
|
|
22
|
+
[K in keyof T]: Prettify<T[K]>;
|
|
23
|
+
} & {};
|
|
21
24
|
|
|
22
|
-
export { NonReadonly, Union2Intersection, sleep, toArray };
|
|
25
|
+
export { type NonReadonly, type Prettify, type Union2Intersection, sleep, toArray };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/to-array.ts","../src/sleep.ts","../src/index.ts"],"sourcesContent":["/**\n * 返回数组,如果传入非数组,则会包装成只有一个元素的数组\n * @param data 非数组或者数组\n * @param unique 是否需要去重。默认:`false`\n */\nexport function toArray<T>(data: T | readonly T[], unique?: boolean): T[];\nexport function toArray<T>(data: T | T[], unique?: boolean): T[];\nexport function toArray<T>(data: T | T[], unique: boolean = false): T[] {\n return Array.isArray(data) ? (unique ? [...new Set(data)] : data) : [data];\n}\n","/**\n *
|
|
1
|
+
{"version":3,"sources":["../src/to-array.ts","../src/sleep.ts","../src/index.ts"],"sourcesContent":["/**\n * 返回数组,如果传入非数组,则会包装成只有一个元素的数组\n * @param data 非数组或者数组\n * @param unique 是否需要去重。默认:`false`\n */\nexport function toArray<T>(data: T | readonly T[], unique?: boolean): T[];\nexport function toArray<T>(data: T | T[], unique?: boolean): T[];\nexport function toArray<T>(data: T | T[], unique: boolean = false): T[] {\n return Array.isArray(data) ? (unique ? [...new Set(data)] : data) : [data];\n}\n","/**\n * 等待指定的时间(毫秒)后再往下执行\n */\nexport const sleep = (durationMS: number): Promise<void> =>\n durationMS <= 0\n ? Promise.resolve(void 0)\n : new Promise((resolve) => {\n setTimeout(resolve, durationMS);\n });\n","export * from './to-array';\nexport * from './sleep';\nexport * from './type';\nexport { default as chalk } from 'chalk';\nexport { default as bytes } from 'bytes';\n"],"mappings":";AAOO,SAAS,QAAW,MAAe,SAAkB,OAAY;AACtE,SAAO,MAAM,QAAQ,IAAI,IAAK,SAAS,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,OAAQ,CAAC,IAAI;AAC3E;;;ACNO,IAAM,QAAQ,CAAC,eACpB,cAAc,IACV,QAAQ,QAAQ,MAAM,IACtB,IAAI,QAAQ,CAAC,YAAY;AACvB,aAAW,SAAS,UAAU;AAChC,CAAC;;;ACLP,SAAoB,WAAXA,gBAAwB;AACjC,SAAoB,WAAXA,gBAAwB;","names":["default"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aomex/internal-tools",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "aomex内部实用工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"README.md",
|
|
22
22
|
"CHANGELOG.md"
|
|
23
23
|
],
|
|
24
|
-
"keywords": [],
|
|
25
24
|
"repository": "git@github.com:aomex/aomex.git",
|
|
26
25
|
"homepage": "https://aomex.js.org",
|
|
27
26
|
"license": "MIT",
|
|
@@ -30,7 +29,5 @@
|
|
|
30
29
|
"bytes": "^3.1.2",
|
|
31
30
|
"chalk": "^5.3.0"
|
|
32
31
|
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"test": "vitest"
|
|
35
|
-
}
|
|
32
|
+
"scripts": {}
|
|
36
33
|
}
|