@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.
@@ -1,3 +1,6 @@
1
1
  export declare const slugify: ({ value }: {
2
2
  value: string;
3
3
  }) => string;
4
+ export declare const unslugify: ({ value }: {
5
+ value: string;
6
+ }) => string;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.66",
3
+ "version": "2.2.67",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
+ };