forked from uuidjs/uuid
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
235 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ Christoph Tavan <[email protected]> | |
AJ ONeal <[email protected]> | ||
Vincent Voyer <[email protected]> | ||
Roman Shtylman <[email protected]> | ||
Patrick McCarren <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
For the creation of [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) UUIDs | ||
|
||
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs | ||
- **Complete** - Support for RFC4122 version 1, 3, 4, 5, and 7 UUIDs | ||
- **Cross-platform** - Support for ... | ||
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds) | ||
- Node 12, 14, 16, 18 | ||
|
@@ -56,6 +56,7 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ... | |
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | | | ||
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | | | ||
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | | | ||
| [`uuid.v7()`](#uuidv7unix-epoch-time-based) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@9.?` | | ||
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `[email protected]` | | ||
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `[email protected]` | | ||
|
||
|
@@ -248,6 +249,28 @@ import { v5 as uuidv5 } from 'uuid'; | |
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1' | ||
``` | ||
|
||
### uuid.v7([options[, buffer[, offset]]]) | ||
|
||
Create an RFC version 7 (random) UUID | ||
|
||
| | | | ||
| --- | --- | | ||
| [`options`] | `Object` with one or more of the following properties: | | ||
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) | | ||
| [`options.random`] | `Array` of 16 random bytes (0-255) | | ||
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) | | ||
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` | | ||
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` | | ||
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` | | ||
|
||
Example: | ||
|
||
```javascript | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
uuidv7(); // ⇨ '017f22e2-79b0-7cc3-98c4-dc0c0c07398f' | ||
``` | ||
|
||
### uuid.validate(str) | ||
|
||
Test a string to see if it is a valid UUID | ||
|
@@ -322,6 +345,8 @@ Usage: | |
uuid v3 <name> <namespace uuid> | ||
uuid v4 | ||
uuid v5 <name> <namespace uuid> | ||
uuid v7 | ||
uuid v7 <unix timestamp> | ||
uuid --help | ||
|
||
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ require('crypto').randomUUID = undefined; | |
|
||
For the creation of [RFC4122](https://www.ietf.org/rfc/rfc4122.txt) UUIDs | ||
|
||
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs | ||
- **Complete** - Support for RFC4122 version 1, 3, 4, 5, and 7 UUIDs | ||
- **Cross-platform** - Support for ... | ||
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds) | ||
- Node 12, 14, 16, 18 | ||
|
@@ -71,6 +71,7 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ... | |
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | | | ||
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | | | ||
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | | | ||
| [`uuid.v7()`](#uuidv7unix-epoch-time-based) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@9.?` | | ||
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `[email protected]` | | ||
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `[email protected]` | | ||
|
||
|
@@ -257,6 +258,28 @@ import { v5 as uuidv5 } from 'uuid'; | |
uuidv5('https://www.w3.org/', uuidv5.URL); // RESULT | ||
``` | ||
|
||
### uuid.v7([options[, buffer[, offset]]]) | ||
|
||
Create an RFC version 7 (random) UUID | ||
|
||
| | | | ||
| --- | --- | | ||
| [`options`] | `Object` with one or more of the following properties: | | ||
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) | | ||
| [`options.random`] | `Array` of 16 random bytes (0-255) | | ||
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) | | ||
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` | | ||
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` | | ||
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` | | ||
|
||
Example: | ||
|
||
```javascript --run | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
uuidv7(); // RESULT | ||
``` | ||
|
||
### uuid.validate(str) | ||
|
||
Test a string to see if it is a valid UUID | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>UUID esmodule webpack example</title> | ||
</head> | ||
|
||
<body> | ||
<script type="text/javascript" src="./dist/v7.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
import testpage from '../utils/testpage'; | ||
|
||
testpage(function (addTest, done) { | ||
addTest('uuidv7()', uuidv7()); | ||
done(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
uuidv7(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>UUID esmodule webpack example</title> | ||
</head> | ||
|
||
<body> | ||
<script type="text/javascript" src="./dist/v7.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
import testpage from '../utils/testpage'; | ||
|
||
testpage(function (addTest, done) { | ||
addTest('uuidv7()', uuidv7()); | ||
|
||
done(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
uuidv7(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.