@esmate/utils 1.2.2 → 1.2.3
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 +93 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1,94 @@
|
|
|
1
1
|
# @esmate/utils
|
|
2
|
+
|
|
3
|
+
A comprehensive utility library that consolidates powerful tools for modern JavaScript/TypeScript development. This
|
|
4
|
+
package provides convenient access to es-toolkit, lodash-compatible functions, math operations, and string manipulation
|
|
5
|
+
utilities through a unified interface.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @esmate/utils
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **es-toolkit**: Modern, high-performance utility functions
|
|
16
|
+
- **Lodash compatibility**: Familiar lodash functions reimplemented with es-toolkit
|
|
17
|
+
- **Math operations**: Comprehensive mathematical utilities via math.js
|
|
18
|
+
- **String utilities**: Advanced string manipulation including title case conversion and typo correction
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### ESToolkit Utilities
|
|
25
|
+
|
|
26
|
+
Access [es-toolkit](https://es-toolkit.dev/reference/array/at.html) functions through the main package export or the
|
|
27
|
+
dedicated toolkit subpath.
|
|
28
|
+
|
|
29
|
+
**Import from main package:**
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { delay, invariant } from "@esmate/utils";
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Import from toolkit subpath:**
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { delay, invariant } from "@esmate/utils/toolkit";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
📚 **Documentation**: [es-toolkit reference](https://es-toolkit.dev/reference/array/at.html)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### Lodash Utilities
|
|
46
|
+
|
|
47
|
+
Access [lodash](https://lodash.com/docs) functions reimplemented using es-toolkit's compatibility mode for familiar,
|
|
48
|
+
drop-in replacements.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { chunk, debounce } from "@esmate/utils/lodash";
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
📚 **Documentation**: [Lodash compatibility reference](https://es-toolkit.dev/compatibility.html)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Math Utilities
|
|
59
|
+
|
|
60
|
+
Leverage the full power of [math.js](https://mathjs.org/docs/index.html) for mathematical operations and calculations.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { round, sqrt } from "@esmate/utils/math";
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
📚 **Documentation**: [math.js reference](https://mathjs.org/docs/index.html)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### String Utilities
|
|
71
|
+
|
|
72
|
+
#### `titleize()`
|
|
73
|
+
|
|
74
|
+
Converts strings to proper title case using the [title](https://www.npmjs.com/package/title) package.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { titleize } from "@esmate/utils/string";
|
|
78
|
+
|
|
79
|
+
const result = titleize("hello world"); // "Hello World"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
📚 **Documentation**: [View source](https://github.com/VienDinhCom/esmate/blob/main/packages/utils/src/string.ts)
|
|
83
|
+
|
|
84
|
+
#### `fixTypos()`
|
|
85
|
+
|
|
86
|
+
Automatically corrects common typographical errors using [typopo](https://www.npmjs.com/package/typopo).
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { fixTypos } from "@esmate/utils/string";
|
|
90
|
+
|
|
91
|
+
const result = fixTypos("This is a text with typos..."); // "This is a text with typos…"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
📚 **Documentation**: [View source](https://github.com/VienDinhCom/esmate/blob/main/packages/utils/src/string.ts)
|