@softsky/utils 2.5.0 → 2.5.1

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/README.md CHANGED
@@ -110,7 +110,8 @@ Utils related to code execution flow.
110
110
  ${\textsf{\color{ForestGreen}const}}$ generateNumberId - Get unique number id
111
111
 
112
112
  ---
113
- ${\textsf{\color{CornflowerBlue}function}}$ UUID - Get universally unique string id
113
+ ${\textsf{\color{CornflowerBlue}function}}$ UUID - Get universally unique string id.
114
+ You can get information then id was generated using extractUUIDDate(uuid)
114
115
 
115
116
  ---
116
117
  ${\textsf{\color{CornflowerBlue}function}}$ extractUUIDDate - Extract exact date of uuid generation
package/dist/control.d.ts CHANGED
@@ -4,7 +4,10 @@
4
4
  import { AwaitedObject, JSONSerializable } from './types';
5
5
  /** Get unique number id */
6
6
  export declare const generateNumberId: () => number;
7
- /** Get universally unique string id */
7
+ /**
8
+ * Get universally unique string id.
9
+ * You can get information then id was generated using extractUUIDDate(uuid)
10
+ */
8
11
  export declare function UUID(): string;
9
12
  /** Extract exact date of uuid generation */
10
13
  export declare function extractUUIDDate(uuid: string): Date;
package/dist/control.js CHANGED
@@ -1,13 +1,20 @@
1
1
  /**
2
2
  * Utils related to code execution flow.
3
3
  */
4
+ let stringIdInc = 0;
4
5
  let _uuid = Date.now() * 1000;
5
6
  /** Get unique number id */
6
7
  export const generateNumberId = () => _uuid++;
7
8
  const SESSION_ID = ((Math.random() * 2_147_483_648) | 0).toString(16);
8
- let stringIdInc = 0;
9
- /** Get universally unique string id */
9
+ /**
10
+ * Get universally unique string id.
11
+ * You can get information then id was generated using extractUUIDDate(uuid)
12
+ */
10
13
  export function UUID() {
14
+ if (stringIdInc === 46_655)
15
+ stringIdInc = 0;
16
+ else
17
+ stringIdInc++;
11
18
  return `${Date.now().toString(36).padStart(11, '0')}${(++stringIdInc).toString(36).padStart(3, '0')}${SESSION_ID}`;
12
19
  }
13
20
  /** Extract exact date of uuid generation */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softsky/utils",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "JavaScript/TypeScript utilities",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {