react-util-tools 1.0.25 → 1.0.27
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 +38 -0
- package/dist/index.cjs +404 -78
- package/dist/index.d.cts +45 -1
- package/dist/index.d.ts +45 -1
- package/dist/index.js +359 -76
- package/package.json +1 -1
- package/src/format/index.ts +263 -102
- package/src/index.ts +45 -0
- package/src/string/README.md +441 -0
- package/src/string/index.ts +527 -0
package/README.md
CHANGED
|
@@ -145,6 +145,19 @@ const total = new Decimal('0.1').plus('0.2') // Decimal(0.3)
|
|
|
145
145
|
|
|
146
146
|
[查看文档](./src/excel/README.md)
|
|
147
147
|
|
|
148
|
+
### 🔤 String - 字符串工具
|
|
149
|
+
强大的字符串处理工具集合:
|
|
150
|
+
- `camelCase()` / `snakeCase()` / `kebabCase()` - 命名转换
|
|
151
|
+
- `truncate()` / `padStart()` / `padEnd()` - 字符串操作
|
|
152
|
+
- `maskPhone()` / `maskIdCard()` / `maskBankCard()` - 数据脱敏
|
|
153
|
+
- `isValidPhone()` / `isValidEmail()` / `isValidUrl()` - 格式验证
|
|
154
|
+
- `randomString()` / `uuid()` - 随机生成
|
|
155
|
+
- `toBase64()` / `fromBase64()` - Base64 编解码
|
|
156
|
+
- `escapeHtml()` / `stripHtml()` - HTML 处理
|
|
157
|
+
- 更多...
|
|
158
|
+
|
|
159
|
+
[查看文档](./src/string/README.md)
|
|
160
|
+
|
|
148
161
|
## 使用示例
|
|
149
162
|
|
|
150
163
|
### 节流防抖
|
|
@@ -302,6 +315,31 @@ function exportData() {
|
|
|
302
315
|
}
|
|
303
316
|
```
|
|
304
317
|
|
|
318
|
+
### 字符串处理
|
|
319
|
+
|
|
320
|
+
```typescript
|
|
321
|
+
import {
|
|
322
|
+
camelCase,
|
|
323
|
+
maskPhone,
|
|
324
|
+
isValidEmail,
|
|
325
|
+
randomString,
|
|
326
|
+
uuid
|
|
327
|
+
} from 'react-tools'
|
|
328
|
+
|
|
329
|
+
// 命名转换
|
|
330
|
+
camelCase('hello-world') // 'helloWorld'
|
|
331
|
+
|
|
332
|
+
// 数据脱敏
|
|
333
|
+
maskPhone('13812345678') // '138****5678'
|
|
334
|
+
|
|
335
|
+
// 格式验证
|
|
336
|
+
isValidEmail('test@example.com') // true
|
|
337
|
+
|
|
338
|
+
// 随机生成
|
|
339
|
+
randomString(8) // 'aB3xY9Zk'
|
|
340
|
+
uuid() // '550e8400-e29b-41d4-a716-446655440000'
|
|
341
|
+
```
|
|
342
|
+
|
|
305
343
|
## TypeScript 支持
|
|
306
344
|
|
|
307
345
|
完整的 TypeScript 类型支持,开箱即用。
|