@esmate/utils 1.2.4 → 1.3.0
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 +5 -9
- package/dist/string.d.ts +1 -1
- package/dist/string.js +1 -1
- package/package.json +3 -3
- package/dist/toolkit.d.ts +0 -1
- package/dist/toolkit.js +0 -1
package/README.md
CHANGED
|
@@ -26,18 +26,10 @@ npm install @esmate/utils
|
|
|
26
26
|
Access [es-toolkit](https://es-toolkit.dev/reference/array/at.html) functions through the main package export or the
|
|
27
27
|
dedicated toolkit subpath.
|
|
28
28
|
|
|
29
|
-
**Import from main package:**
|
|
30
|
-
|
|
31
29
|
```ts
|
|
32
30
|
import { delay, invariant } from "@esmate/utils";
|
|
33
31
|
```
|
|
34
32
|
|
|
35
|
-
**Import from toolkit subpath:**
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
import { delay, invariant } from "@esmate/utils/toolkit";
|
|
39
|
-
```
|
|
40
|
-
|
|
41
33
|
📚 **Documentation**: [es-toolkit reference](https://es-toolkit.dev/reference/array/at.html)
|
|
42
34
|
|
|
43
35
|
---
|
|
@@ -76,7 +68,11 @@ Converts strings to proper title case using the [title](https://www.npmjs.com/pa
|
|
|
76
68
|
```ts
|
|
77
69
|
import { titleize } from "@esmate/utils/string";
|
|
78
70
|
|
|
79
|
-
const
|
|
71
|
+
const title = titleize("hello world"); // "Hello World"
|
|
72
|
+
|
|
73
|
+
const chicagoTitle = titleize("love of my life", { style: "chicago" }); // "Love of My Life"
|
|
74
|
+
|
|
75
|
+
const specialTitle = titleize("i love ESMate", { special: ["ESMate"] }); // "I Love ESMate"
|
|
80
76
|
```
|
|
81
77
|
|
|
82
78
|
📚 **Documentation**: [View source](https://github.com/VienDinhCom/esmate/blob/main/packages/utils/src/string.ts)
|
package/dist/string.d.ts
CHANGED
package/dist/string.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_title__ from "title";
|
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_typopo__ from "typopo";
|
|
4
4
|
function titleize(str, options) {
|
|
5
5
|
str = str.replace(/\s+/g, " ");
|
|
6
|
-
if (options?.
|
|
6
|
+
if (options?.style === "chicago") return (0, __WEBPACK_EXTERNAL_MODULE_title__["default"])(str, options);
|
|
7
7
|
const specialWordsLower = options?.special?.map((s)=>s.toLocaleLowerCase());
|
|
8
8
|
return str.split(" ").map((word)=>specialWordsLower?.includes(word.toLocaleLowerCase()) ? word : (0, __WEBPACK_EXTERNAL_MODULE_es_toolkit_string_d01e99ad__.capitalize)(word)).join(" ");
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esmate/utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "JavaScript/TypeScript utils, functions, and classes in one package.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/toolkit.d.ts",
|
|
23
|
-
"import": "./dist/toolkit.js"
|
|
22
|
+
"types": "./dist/pkgs/es-toolkit.d.ts",
|
|
23
|
+
"import": "./dist/pkgs/es-toolkit.js"
|
|
24
24
|
},
|
|
25
25
|
"./*": {
|
|
26
26
|
"types": "./dist/*.d.ts",
|
package/dist/toolkit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "es-toolkit";
|
package/dist/toolkit.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "es-toolkit";
|