Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit edb74af

Browse files
authored
feat(uuid): return RFC 4122 version 4 UUID
1 parent c99b298 commit edb74af

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/modules/uuid.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @function `uuid` - Generate a unique UUID composed of random characters and numbers. UUIDs follow this rule: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
2+
* @function `uuid` - Generate a unique UUID using the RFC 4122 version 4 UUID standard.
33
* @param { Number } [number] - The amount of UUIDs to generate. Condition: **`1 < amount < 64`**
44
* @returns { string | string[] } - Returns an array if the amount inputted is above 1, else returns a string.
55
*/
@@ -19,8 +19,8 @@ module.exports = function uuid(number) {
1919
do {
2020
var d = new Date().getTime();
2121

22-
let uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
23-
/[xy]/g,
22+
let uuid = "xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx".replace(
23+
/[x]/g,
2424
function (c) {
2525
var r = Math.random() * 16;
2626

0 commit comments

Comments
 (0)