@cloudparker/moldex.js 0.0.81 → 0.0.82
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,4 +1,5 @@
|
|
|
1
1
|
import { toDate } from '../date/date-service';
|
|
2
|
+
import { customAlphabet } from 'nanoid';
|
|
2
3
|
/**
|
|
3
4
|
* Generates a random number between the specified minimum and maximum values (inclusive of the minimum and exclusive of the maximum).
|
|
4
5
|
*
|
|
@@ -394,3 +395,11 @@ export function pixelToInch(pixels) {
|
|
|
394
395
|
const DPI = 96; // Default DPI for screen resolution
|
|
395
396
|
return pixels / DPI;
|
|
396
397
|
}
|
|
398
|
+
export function alphabetNanoid(length = 10, lowercase = false) {
|
|
399
|
+
let alphabet = Array.from({ length: 26 }, (_, i) => String.fromCharCode(65 + i)).join('');
|
|
400
|
+
if (lowercase) {
|
|
401
|
+
alphabet = alphabet.toLowerCase();
|
|
402
|
+
}
|
|
403
|
+
const nanoid = customAlphabet(alphabet, length);
|
|
404
|
+
return nanoid();
|
|
405
|
+
}
|