@easbot/utils 0.1.7
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 +119 -0
- package/dist/index.cjs +193 -0
- package/dist/index.d.cts +468 -0
- package/dist/index.d.ts +468 -0
- package/dist/index.mjs +193 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# @easbot/utils
|
|
2
|
+
|
|
3
|
+
[中文](#中文) | [English](#english)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 中文
|
|
8
|
+
|
|
9
|
+
EASBOT 生态系统的共享工具库,现代化、轻量且高效。
|
|
10
|
+
|
|
11
|
+
### 安装
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @easbot/utils
|
|
15
|
+
# 或
|
|
16
|
+
pnpm add @easbot/utils
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### 使用
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import {
|
|
23
|
+
formatDate,
|
|
24
|
+
sleep,
|
|
25
|
+
debounce,
|
|
26
|
+
deepClone,
|
|
27
|
+
generateId
|
|
28
|
+
} from '@easbot/utils';
|
|
29
|
+
|
|
30
|
+
// 使用工具函数
|
|
31
|
+
const id = generateId();
|
|
32
|
+
await sleep(1000);
|
|
33
|
+
const cloned = deepClone({ a: 1, b: { c: 2 } });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 特性
|
|
37
|
+
|
|
38
|
+
- **常用工具**: 日期格式化、sleep、防抖、节流等
|
|
39
|
+
- **类型安全**: 完整的 TypeScript 支持和类型推断
|
|
40
|
+
- **零依赖**: 最小化外部依赖
|
|
41
|
+
- **Tree-shakeable**: 按需导入
|
|
42
|
+
|
|
43
|
+
### 开发
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 安装依赖
|
|
47
|
+
pnpm install
|
|
48
|
+
|
|
49
|
+
# 构建
|
|
50
|
+
pnpm build
|
|
51
|
+
|
|
52
|
+
# 测试
|
|
53
|
+
pnpm test
|
|
54
|
+
|
|
55
|
+
# 类型检查
|
|
56
|
+
pnpm type-check
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 许可证
|
|
60
|
+
|
|
61
|
+
MIT
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## English
|
|
66
|
+
|
|
67
|
+
A modern, lightweight, and fast library for shared utilities in the EASBOT ecosystem.
|
|
68
|
+
|
|
69
|
+
### Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install @easbot/utils
|
|
73
|
+
# or
|
|
74
|
+
pnpm add @easbot/utils
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Usage
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
import {
|
|
81
|
+
formatDate,
|
|
82
|
+
sleep,
|
|
83
|
+
debounce,
|
|
84
|
+
deepClone,
|
|
85
|
+
generateId
|
|
86
|
+
} from '@easbot/utils';
|
|
87
|
+
|
|
88
|
+
// Use utility functions
|
|
89
|
+
const id = generateId();
|
|
90
|
+
await sleep(1000);
|
|
91
|
+
const cloned = deepClone({ a: 1, b: { c: 2 } });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Features
|
|
95
|
+
|
|
96
|
+
- **Common Utilities**: Date formatting, sleep, debounce, throttle, etc.
|
|
97
|
+
- **Type Safety**: Full TypeScript support with proper type inference
|
|
98
|
+
- **Zero Dependencies**: Minimal external dependencies
|
|
99
|
+
- **Tree-shakeable**: Only import what you need
|
|
100
|
+
|
|
101
|
+
### Development
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Install dependencies
|
|
105
|
+
pnpm install
|
|
106
|
+
|
|
107
|
+
# Build
|
|
108
|
+
pnpm build
|
|
109
|
+
|
|
110
|
+
# Test
|
|
111
|
+
pnpm test
|
|
112
|
+
|
|
113
|
+
# Type check
|
|
114
|
+
pnpm type-check
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### License
|
|
118
|
+
|
|
119
|
+
MIT
|