cynx-lib 1.3.117 → 1.3.119
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/package.json +1 -1
- package/utils/utils/uid.cjs +3 -0
- package/utils/utils/uid.js +3 -0
package/package.json
CHANGED
package/utils/utils/uid.cjs
CHANGED
|
@@ -121,6 +121,9 @@ function shortId(size = 8) {
|
|
|
121
121
|
return uid(size, ALPHABETS.alphanumeric);
|
|
122
122
|
}
|
|
123
123
|
function prefixedId(prefix = "id", size = 12, alphabet = ALPHABETS.alphanumeric) {
|
|
124
|
+
if (prefix === "" || prefix === null || prefix === false) {
|
|
125
|
+
return uid(size, alphabet);
|
|
126
|
+
}
|
|
124
127
|
const p = String(prefix || "id").replace(/_+$/, "");
|
|
125
128
|
return `${p}_${uid(size, alphabet)}`;
|
|
126
129
|
}
|
package/utils/utils/uid.js
CHANGED
|
@@ -161,6 +161,9 @@ export function shortId(size = 8) {
|
|
|
161
161
|
* @returns {string}
|
|
162
162
|
*/
|
|
163
163
|
export function prefixedId(prefix = 'id', size = 12, alphabet = ALPHABETS.alphanumeric) {
|
|
164
|
+
if (prefix === '' || prefix === null || prefix === false) {
|
|
165
|
+
return uid(size, alphabet);
|
|
166
|
+
}
|
|
164
167
|
const p = String(prefix || 'id').replace(/_+$/, '');
|
|
165
168
|
return `${p}_${uid(size, alphabet)}`;
|
|
166
169
|
}
|