@irpclib/irpc 0.0.1 → 1.0.0-beta.16

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.d.ts DELETED
@@ -1,17 +0,0 @@
1
- //#region src/utils.d.ts
2
- /**
3
- * Generates a short unique identifier string.
4
- *
5
- * This function creates a unique ID by combining:
6
- * - A timestamp in base-36 format
7
- * - A sequence number in base-36 format (padded to 3 characters)
8
- * - A random string in base-36 format (4 characters)
9
- *
10
- * The sequence number ensures uniqueness when multiple IDs are generated within the same millisecond.
11
- * The random part adds additional entropy to reduce predictability.
12
- *
13
- * @returns A unique string identifier
14
- */
15
- declare function shortId(): string;
16
- //#endregion
17
- export { shortId };
package/dist/utils.js DELETED
@@ -1,26 +0,0 @@
1
- //#region src/utils.ts
2
- let lastTimestamp = 0;
3
- let sequence = 0;
4
- /**
5
- * Generates a short unique identifier string.
6
- *
7
- * This function creates a unique ID by combining:
8
- * - A timestamp in base-36 format
9
- * - A sequence number in base-36 format (padded to 3 characters)
10
- * - A random string in base-36 format (4 characters)
11
- *
12
- * The sequence number ensures uniqueness when multiple IDs are generated within the same millisecond.
13
- * The random part adds additional entropy to reduce predictability.
14
- *
15
- * @returns A unique string identifier
16
- */
17
- function shortId() {
18
- const timestamp = Date.now();
19
- if (timestamp === lastTimestamp) sequence++;
20
- else sequence = 0;
21
- lastTimestamp = timestamp;
22
- return `${timestamp.toString(36)}${sequence.toString(36).padStart(3, "0")}${Math.random().toString(36).substring(2, 6)}`;
23
- }
24
-
25
- //#endregion
26
- export { shortId };