@esmate/utils 1.2.3 → 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 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 result = titleize("hello world"); // "Hello World"
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
@@ -6,7 +6,7 @@ import type { Configuration, Locale } from "typopo";
6
6
  * @returns The formatted string.
7
7
  */
8
8
  export declare function titleize(str: string, options?: {
9
- locale?: "en";
9
+ style?: "chicago";
10
10
  special?: string[];
11
11
  }): string;
12
12
  /**
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?.locale === "en") return (0, __WEBPACK_EXTERNAL_MODULE_title__["default"])(str, 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.2.3",
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",
@@ -40,7 +40,6 @@
40
40
  "iso-3166-1": "^2.1.1",
41
41
  "iso-639-1": "^3.1.5",
42
42
  "mathjs": "^15.1.0",
43
- "tiny-invariant": "^1.3.3",
44
43
  "title": "^4.0.1",
45
44
  "typopo": "^2.8.0"
46
45
  },
@@ -1,2 +0,0 @@
1
- export * from "tiny-invariant";
2
- export { default } from "tiny-invariant";
@@ -1,4 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_tiny_invariant_25fdef25__ from "tiny-invariant";
2
- export * from "tiny-invariant";
3
- var __webpack_exports__default = __WEBPACK_EXTERNAL_MODULE_tiny_invariant_25fdef25__["default"];
4
- export { __webpack_exports__default as default };
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";