@pastelarai/pastelarai-shared-types 1.0.47 → 1.0.49
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/utils.d.ts +2 -0
- package/dist/utils/utils.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateId = exports.normalizeName = void 0;
|
|
4
|
+
const normalizeName = (name) => {
|
|
5
|
+
if (!name)
|
|
6
|
+
return "";
|
|
7
|
+
return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
|
|
8
|
+
};
|
|
9
|
+
exports.normalizeName = normalizeName;
|
|
10
|
+
// Utility function to generate _id from the name by normalizing it
|
|
11
|
+
const generateId = (name) => {
|
|
12
|
+
return name
|
|
13
|
+
.toLowerCase()
|
|
14
|
+
.trim()
|
|
15
|
+
.replace(/\s+/g, "-") // Replace spaces with dashes
|
|
16
|
+
.replace(/[^a-z0-9-]/g, ""); // Remove non-alphanumeric characters
|
|
17
|
+
};
|
|
18
|
+
exports.generateId = generateId;
|