-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
37 changed files
with
9,850 additions
and
15,438 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
node_modules/ | ||
dist/ | ||
# Browserstack | ||
*.tgz | ||
browserstack.err | ||
dist/ | ||
local.log | ||
*.tgz | ||
node_modules/ | ||
vscode/ |
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 @@ | ||
../../v1tov6.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../v6.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../v6tov1.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,4 +2,6 @@ | |
dist/ | ||
node_modules/ | ||
README.md | ||
*.sh | ||
*.sh | ||
.gitignore | ||
.prettierignore |
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,11 +2,12 @@ | |
-- This file is auto-generated from README_js.md. Changes should be made there. | ||
--> | ||
|
||
|
||
# uuid [![CI](https://github.com/uuidjs/uuid/workflows/CI/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [![Browser](https://github.com/uuidjs/uuid/workflows/Browser/badge.svg)](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser) | ||
|
||
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formally [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs | ||
|
||
- **Complete** - Support for all RFC9562 UUID versions | ||
- **Complete** - Support for all RFC9562 (nee RFC4122) UUID versions | ||
- **Cross-platform** - Support for ... | ||
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds) | ||
- NodeJS 16+ ([LTS releases](https://github.com/nodejs/Release)) | ||
|
@@ -60,10 +61,13 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ... | |
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `[email protected]` | | ||
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `[email protected]` | | ||
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | | | ||
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` | | ||
| [`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.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` | | ||
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` | | ||
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` | | ||
| [`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]` | | ||
|
||
|
@@ -191,13 +195,23 @@ Example using `options`: | |
```javascript | ||
import { v1 as uuidv1 } from 'uuid'; | ||
|
||
const v1options = { | ||
const options = { | ||
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], | ||
clockseq: 0x1234, | ||
msecs: new Date('2011-11-01').getTime(), | ||
nsecs: 5678, | ||
}; | ||
uuidv1(v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab' | ||
uuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab' | ||
``` | ||
|
||
### uuid.v1ToV6(uuid) | ||
|
||
Convert a UUID from version 1 to version 6 | ||
|
||
```javascript | ||
import { v1ToV6 } from 'uuid'; | ||
|
||
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47' | ||
``` | ||
|
||
### uuid.v3(name, namespace[, buffer[, offset]]) | ||
|
@@ -280,6 +294,42 @@ import { v5 as uuidv5 } from 'uuid'; | |
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1' | ||
``` | ||
|
||
### uuid.v6([options[, buffer[, offset]]]) | ||
|
||
Create an RFC version 6 (timestamp, reordered) UUID | ||
|
||
This method takes the same arguments as uuid.v1(). | ||
|
||
```javascript | ||
import { v6 as uuidv6 } from 'uuid'; | ||
|
||
uuidv6(); // ⇨ '1e940672-c5ea-64c0-8bad-9b1deb4d3b7d' | ||
``` | ||
|
||
Example using `options`: | ||
|
||
```javascript | ||
import { v6 as uuidv6 } from 'uuid'; | ||
|
||
const options = { | ||
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], | ||
clockseq: 0x1234, | ||
msecs: new Date('2011-11-01').getTime(), | ||
nsecs: 5678, | ||
}; | ||
uuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab' | ||
``` | ||
|
||
### uuid.v6ToV1(uuid) | ||
|
||
Convert a UUID from version 6 to version 1 | ||
|
||
```javascript | ||
import { v6ToV1 } from 'uuid'; | ||
|
||
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47' | ||
``` | ||
|
||
### uuid.v7([options[, buffer[, offset]]]) | ||
|
||
Create an RFC version 7 (random) UUID | ||
|
@@ -300,7 +350,7 @@ Example: | |
```javascript | ||
import { v7 as uuidv7 } from 'uuid'; | ||
|
||
uuidv7(); // ⇨ '01695553-c90c-7aad-9bdd-330d7b3dcb6d' | ||
uuidv7(); // ⇨ '01695553-c90c-722d-9b5d-b38dfbbd4bed' | ||
``` | ||
|
||
### uuid.validate(str) | ||
|
@@ -520,5 +570,6 @@ const uuid = require('uuid'); // <== REMOVED! | |
|
||
This usage pattern was already discouraged in `uuid@3` and has been removed in `uuid@7`. | ||
|
||
---- | ||
Markdown generated from [README_js.md](README_js.md) by [![RunMD Logo](https://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd) | ||
--- | ||
|
||
Markdown generated from [README_js.md](README_js.md) by <a href="https://github.com/broofa/runmd"><image height="12px" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" /></a> |
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 [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formally [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs | ||
|
||
- **Complete** - Support for RFC9562 version 1, 3, 4, 5, and 7 UUIDs | ||
- **Complete** - Support for all RFC9562 (nee RFC4122) UUID versions | ||
- **Cross-platform** - Support for ... | ||
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and [CDN builds](#cdn-builds) | ||
- NodeJS 16+ ([LTS releases](https://github.com/nodejs/Release)) | ||
|
@@ -75,10 +75,13 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ... | |
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `[email protected]` | | ||
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `[email protected]` | | ||
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | | | ||
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` | | ||
| [`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.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` | | ||
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` | | ||
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` | | ||
| [`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]` | | ||
|
||
|
@@ -200,13 +203,23 @@ Example using `options`: | |
```javascript --run | ||
import { v1 as uuidv1 } from 'uuid'; | ||
|
||
const v1options = { | ||
const options = { | ||
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], | ||
clockseq: 0x1234, | ||
msecs: new Date('2011-11-01').getTime(), | ||
nsecs: 5678, | ||
}; | ||
uuidv1(v1options); // RESULT | ||
uuidv1(options); // RESULT | ||
``` | ||
|
||
### uuid.v1ToV6(uuid) | ||
|
||
Convert a UUID from version 1 to version 6 | ||
|
||
```javascript --run | ||
import { v1ToV6 } from 'uuid'; | ||
|
||
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // RESULT | ||
``` | ||
|
||
### uuid.v3(name, namespace[, buffer[, offset]]) | ||
|
@@ -289,6 +302,42 @@ import { v5 as uuidv5 } from 'uuid'; | |
uuidv5('https://www.w3.org/', uuidv5.URL); // RESULT | ||
``` | ||
|
||
### uuid.v6([options[, buffer[, offset]]]) | ||
|
||
Create an RFC version 6 (timestamp, reordered) UUID | ||
|
||
This method takes the same arguments as uuid.v1(). | ||
|
||
```javascript --run | ||
import { v6 as uuidv6 } from 'uuid'; | ||
|
||
uuidv6(); // RESULT | ||
``` | ||
|
||
Example using `options`: | ||
|
||
```javascript --run | ||
import { v6 as uuidv6 } from 'uuid'; | ||
|
||
const options = { | ||
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], | ||
clockseq: 0x1234, | ||
msecs: new Date('2011-11-01').getTime(), | ||
nsecs: 5678, | ||
}; | ||
uuidv6(options); // RESULT | ||
``` | ||
|
||
### uuid.v6ToV1(uuid) | ||
|
||
Convert a UUID from version 6 to version 1 | ||
|
||
```javascript --run | ||
import { v6ToV1 } from 'uuid'; | ||
|
||
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // RESULT | ||
``` | ||
|
||
### uuid.v7([options[, buffer[, offset]]]) | ||
|
||
Create an RFC version 7 (random) 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.