@zengzizhao/test-utils 0.0.1 → 0.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/README.md +62 -0
- package/package.json +7 -6
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @zengzizhao/test-utils
|
|
2
|
+
|
|
3
|
+
一个轻量级的 TypeScript 工具函数库,支持 Node.js 和浏览器环境。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @zengzizhao/test-utils
|
|
9
|
+
# 或
|
|
10
|
+
pnpm add @zengzizhao/test-utils
|
|
11
|
+
# 或
|
|
12
|
+
yarn add @zengzizhao/test-utils
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
### ES Module
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { sum, multiply } from "@zengzizhao/test-utils";
|
|
21
|
+
|
|
22
|
+
sum(1, 2); // 3
|
|
23
|
+
multiply(2, 3); // 6
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### CommonJS
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
const { sum, multiply } = require("@zengzizhao/test-utils");
|
|
30
|
+
|
|
31
|
+
sum(1, 2); // 3
|
|
32
|
+
multiply(2, 3); // 6
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
### Math 数学函数
|
|
38
|
+
|
|
39
|
+
#### `sum(a: number, b: number): number`
|
|
40
|
+
|
|
41
|
+
计算两个数的和。
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
sum(1, 2); // 3
|
|
45
|
+
sum(-1, 1); // 0
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### `multiply(a: number, b: number): number`
|
|
49
|
+
|
|
50
|
+
计算两个数的乘积。
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
multiply(2, 3); // 6
|
|
54
|
+
multiply(-2, 3); // -6
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 特性
|
|
58
|
+
|
|
59
|
+
- 使用 TypeScript 编写,提供完整的类型定义
|
|
60
|
+
- 同时支持 ESM 和 CommonJS
|
|
61
|
+
- 支持 Node.js 和浏览器环境
|
|
62
|
+
- 零依赖,轻量级
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zengzizhao/test-utils",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"description": "工具库",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"utils",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
],
|
|
10
10
|
"author": "zengzizhao",
|
|
11
11
|
"license": "ISC",
|
|
12
|
-
"packageManager": "pnpm@10.19.0",
|
|
13
12
|
"repository": {
|
|
14
13
|
"type": "git",
|
|
15
14
|
"url": "git+https://github.com/Zengzzhao/test-utils.git"
|
|
@@ -35,11 +34,13 @@
|
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
36
|
"type": "module",
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build": "tsdown"
|
|
40
|
-
},
|
|
41
37
|
"devDependencies": {
|
|
38
|
+
"@changesets/cli": "^2.29.8",
|
|
42
39
|
"tsdown": "^0.18.3",
|
|
43
40
|
"typescript": "^5.9.3"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsdown",
|
|
44
|
+
"release": "pnpm tsdown && changeset publish"
|
|
44
45
|
}
|
|
45
|
-
}
|
|
46
|
+
}
|