generate-uuid-version 1.0.0 → 2.0.0

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.
Files changed (3) hide show
  1. package/README.md +8 -22
  2. package/index.js +5 -39
  3. package/package.json +2 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # generate-uuid-version
2
2
 
3
- Generate UUID values (v1, v3, v4, v5, v6, v7) with simple controls.
3
+ Generate UUID values (v4, v7) with simple controls.
4
4
 
5
5
  ---
6
6
 
@@ -48,16 +48,17 @@ console.log(result);
48
48
  | Field | Type | Required | Default | Description |
49
49
  |------|------|----------|--------|------------|
50
50
  | count | number | No | 1 | Number of UUIDs to generate (min 1, max 10) |
51
- | version | string | No | v7 | UUID version: v1, v3, v4, v5, v6, v7 |
52
- | name | string | No* | - | Required for v3 and v5 |
53
- | namespace | string | No* | - | Required for v3 and v5 |
54
-
55
- \* `name` and `namespace` are required when using `v3` or `v5`
51
+ | version | string | No | v7 | UUID version: v4 or v7 |
56
52
 
57
53
  ---
58
54
 
59
55
  ## Examples
60
56
 
57
+ ### Default (v7)
58
+ ```js
59
+ generateUUID({ count: 2 });
60
+ ```
61
+
61
62
  ### v4 (random)
62
63
  ```js
63
64
  generateUUID({ count: 2, version: "v4" });
@@ -68,25 +69,11 @@ generateUUID({ count: 2, version: "v4" });
68
69
  generateUUID({ count: 2, version: "v7" });
69
70
  ```
70
71
 
71
- ### v5 (deterministic)
72
- ```js
73
- generateUUID({
74
- count: 1,
75
- version: "v5",
76
- name: "example.com",
77
- namespace: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
78
- });
79
- ```
80
-
81
72
  ---
82
73
 
83
74
  ## Supported Versions
84
75
 
85
- - v1 → timestamp-based
86
- - v3 → deterministic (MD5)
87
76
  - v4 → random
88
- - v5 → deterministic (SHA-1)
89
- - v6 → reordered timestamp
90
77
  - v7 → modern time-based (recommended)
91
78
 
92
79
  ---
@@ -104,8 +91,7 @@ If using in a Zapier Code step, add:
104
91
 
105
92
  - Invalid or missing `count` defaults to 1
106
93
  - Maximum `count` is 10
107
- - Invalid `version` defaults to v7
108
- - v3 and v5 require `name` and `namespace`
94
+ - Invalid or missing `version` defaults to v7
109
95
 
110
96
  ---
111
97
 
package/index.js CHANGED
@@ -1,28 +1,17 @@
1
1
  // /index.js
2
2
 
3
- import {
4
- v1 as uuidv1,
5
- v3 as uuidv3,
6
- v4 as uuidv4,
7
- v5 as uuidv5,
8
- v6 as uuidv6,
9
- v7 as uuidv7
10
- } from "uuid";
3
+ import { v4 as uuidv4, v7 as uuidv7 } from "uuid";
11
4
 
12
5
  /**
13
6
  * Generate UUID values
14
7
  * @param {Object} options
15
8
  * @param {number} options.count - number of UUIDs (min 1, max 10)
16
- * @param {string} options.version - "v1","v3","v4","v5","v6","v7"
17
- * @param {string} [options.name] - required for v3/v5
18
- * @param {string} [options.namespace] - required for v3/v5
9
+ * @param {string} options.version - "v4" or "v7"
19
10
  * @returns {Object}
20
11
  */
21
12
  export function generateUUID({
22
13
  count = 1,
23
- version = "v7",
24
- name,
25
- namespace
14
+ version = "v7"
26
15
  } = {}) {
27
16
  // ===============================
28
17
  // VALIDATE COUNT
@@ -35,43 +24,20 @@ export function generateUUID({
35
24
  // NORMALIZE VERSION
36
25
  // ===============================
37
26
  const normalizedVersion = String(version || "v7").toLowerCase();
38
-
39
- const allowedVersions = ["v1", "v3", "v4", "v5", "v6", "v7"];
40
- const finalVersion = allowedVersions.includes(normalizedVersion)
41
- ? normalizedVersion
42
- : "v7";
27
+ const finalVersion = normalizedVersion === "v4" ? "v4" : "v7";
43
28
 
44
29
  // ===============================
45
30
  // GENERATOR MAP
46
31
  // ===============================
47
32
  const generators = {
48
- v1: () => uuidv1(),
49
-
50
- v3: () => {
51
- if (!name || !namespace) {
52
- throw new Error("v3 requires 'name' and 'namespace'");
53
- }
54
- return uuidv3(name, namespace);
55
- },
56
-
57
33
  v4: () => uuidv4(),
58
-
59
- v5: () => {
60
- if (!name || !namespace) {
61
- throw new Error("v5 requires 'name' and 'namespace'");
62
- }
63
- return uuidv5(name, namespace);
64
- },
65
-
66
- v6: () => uuidv6(),
67
-
68
34
  v7: () => uuidv7()
69
35
  };
70
36
 
71
37
  const generator = generators[finalVersion];
72
38
 
73
39
  // ===============================
74
- // GENERATE UUIDS
40
+ // GENERATE
75
41
  // ===============================
76
42
  const list = [];
77
43
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "generate-uuid-version",
3
- "version": "1.0.0",
4
- "description": "Generate UUID values (v1, v3, v4, v5, v6, v7) with count support.",
3
+ "version": "2.0.0",
4
+ "description": "Generate UUID values (v4, v7) with count support.",
5
5
  "type": "module",
6
6
 
7
7
  "main": "./index.js",
@@ -27,11 +27,7 @@
27
27
 
28
28
  "keywords": [
29
29
  "uuid",
30
- "uuidv1",
31
- "uuidv3",
32
30
  "uuidv4",
33
- "uuidv5",
34
- "uuidv6",
35
31
  "uuidv7",
36
32
  "generator",
37
33
  "utility"