-
-
Notifications
You must be signed in to change notification settings - Fork 902
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
39 changed files
with
549 additions
and
20 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../v7.js |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
dist/ | ||
node_modules/ | ||
README.md | ||
*.sh |
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 |
---|---|---|
|
@@ -7,7 +7,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) | ||
- NodeJS 12+ ([LTS releases](https://github.com/nodejs/Release)) | ||
|
@@ -59,6 +59,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()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | `experimental support` | | ||
| [`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]` | | ||
|
||
|
@@ -251,6 +252,29 @@ 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) | | ||
| [`options.seq`] | 31 bit monotonic sequence counter as `Number` between 0 - 0x7fffffff | | ||
| [`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(); // ⇨ '01695553-c90c-7aad-9bdd-330d7b3dcb6d' | ||
``` | ||
|
||
### uuid.validate(str) | ||
|
||
Test a string to see if it is a valid UUID | ||
|
@@ -325,6 +349,7 @@ Usage: | |
uuid v3 <name> <namespace uuid> | ||
uuid v4 | ||
uuid v5 <name> <namespace uuid> | ||
uuid v7 | ||
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) | ||
- NodeJS 12+ ([LTS releases](https://github.com/nodejs/Release)) | ||
|
@@ -73,6 +73,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()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | `experimental support` | | ||
| [`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]` | | ||
|
||
|
@@ -259,6 +260,29 @@ 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) | | ||
| [`options.seq`] | 31 bit monotonic sequence counter as `Number` between 0 - 0x7fffffff | | ||
| [`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 | ||
|
@@ -333,6 +357,7 @@ Usage: | |
uuid v3 <name> <namespace uuid> | ||
uuid v4 | ||
uuid v5 <name> <namespace uuid> | ||
uuid v7 | ||
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,10 @@ | ||
<!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
Oops, something went wrong.