@zyacreatives/shared 2.2.66 → 2.2.67
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/dist/utils/slugify.d.ts +3 -0
- package/dist/utils/slugify.js +9 -1
- package/package.json +1 -1
- package/src/utils/slugify.ts +8 -0
package/dist/utils/slugify.d.ts
CHANGED
package/dist/utils/slugify.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slugify = void 0;
|
|
3
|
+
exports.unslugify = exports.slugify = void 0;
|
|
4
4
|
const slugify = ({ value }) => {
|
|
5
5
|
return value
|
|
6
6
|
.normalize("NFKD")
|
|
@@ -12,3 +12,11 @@ const slugify = ({ value }) => {
|
|
|
12
12
|
.replace(/__+/g, "_"); // Collapse multiple underscores
|
|
13
13
|
};
|
|
14
14
|
exports.slugify = slugify;
|
|
15
|
+
const unslugify = ({ value }) => {
|
|
16
|
+
return value
|
|
17
|
+
.replace(/_/g, " ") // Replace underscores with spaces
|
|
18
|
+
.replace(/\s+/g, " ") // Collapse multiple spaces
|
|
19
|
+
.trim() // Trim leading/trailing spaces
|
|
20
|
+
.replace(/\b\w/g, (c) => c.toUpperCase()); // Capitalize first letter of each word
|
|
21
|
+
};
|
|
22
|
+
exports.unslugify = unslugify;
|
package/package.json
CHANGED
package/src/utils/slugify.ts
CHANGED
|
@@ -8,3 +8,11 @@ export const slugify = ({ value }: { value: string }) => {
|
|
|
8
8
|
.replace(/^_+|_+$/g, "") // Trim leading/trailing underscores
|
|
9
9
|
.replace(/__+/g, "_"); // Collapse multiple underscores
|
|
10
10
|
};
|
|
11
|
+
|
|
12
|
+
export const unslugify = ({ value }: { value: string }) => {
|
|
13
|
+
return value
|
|
14
|
+
.replace(/_/g, " ") // Replace underscores with spaces
|
|
15
|
+
.replace(/\s+/g, " ") // Collapse multiple spaces
|
|
16
|
+
.trim() // Trim leading/trailing spaces
|
|
17
|
+
.replace(/\b\w/g, (c) => c.toUpperCase()); // Capitalize first letter of each word
|
|
18
|
+
};
|