Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": [ [ "@babel/env", { "debug": true } ] ],
"sourceMaps": false
}
5 changes: 5 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Browsers that we support

> 1%
last 2 versions
ie >= 9
6 changes: 6 additions & 0 deletions .dist.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"env": { "browser": true" },
"plugins": ["compat"],
"rules": { "compat/compat": "error" },
"settings": { "polyfills": [ "promises" ] }
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea/**
.DS_Store
node_modules
dist
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Version 1 (timestamp):

```javascript
const uuidv1 = require('uuid/v1');
uuidv1(); // ⇨ '3b99e3e0-7598-11e8-90be-95472fb3ecbd'
uuidv1(); // ⇨ 'ca6e1a90-c355-11e8-bc88-9759f8b66240'

```

Expand Down Expand Up @@ -56,7 +56,7 @@ Version 4 (random):

```javascript
const uuidv4 = require('uuid/v4');
uuidv4(); // ⇨ '3a017fc5-4f50-4db9-b0ce-4547ba0a1bfd'
uuidv4(); // ⇨ 'e57d7cee-a174-4463-9f89-1ada39083c5f'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this value change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the runmd module. tl;dr: 'Got fed up with broken README code samples. 'Wrote a utility to evaluate/annotate said examples. Said utility randomly generates UUIDs each time it's run because random is as random does.


```

Expand All @@ -82,12 +82,15 @@ uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614

## Quickstart - Browser-ready Versions

Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in).
Browser-ready versions of this module are available via [jsdelivr](https://www.jsdelivr.com/), [unpkg](https://unpkg.com/), and also in the `node_modules/uuid/dist` folder in npm downloads of `uuid`.

> Note that we also provide unminified versions with `.js` instead of `.min.js` file extensions if needed.

For version 1 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv1@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv1.min.js"></script>
<!-- <script src="https://unpkg.com/uuid/dist/uuidv1.min.js"></script> -->
<script>
uuidv1(); // -> v1 UUID
</script>
Expand All @@ -96,7 +99,8 @@ uuidv1(); // -> v1 UUID
For version 3 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv3@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv3.min.js"></script>
<!-- <script src="https://unpkg.com/uuid/dist/uuidv3.min.js"></script> -->
<script>
uuidv3('http://example.com/hello', uuidv3.URL); // -> v3 UUID
</script>
Expand All @@ -105,7 +109,11 @@ uuidv3('http://example.com/hello', uuidv3.URL); // -> v3 UUID
For version 4 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv4@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid"></script>
<!-- <script src="https://unpkg.com/uuid"></script> -->
<!-- you could also use this alias to lock to v4 version: -->
<!-- <script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv4.min.js"></script> -->
<!-- <script src="https://unpkg.com/uuid/dist/uuidv4.min.js"></script> -->
<script>
uuidv4(); // -> v4 UUID
</script>
Expand All @@ -114,7 +122,8 @@ uuidv4(); // -> v4 UUID
For version 5 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv5@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv5.min.js"></script>
<!-- <script src="https://unpkg.com/uuid/dist/uuidv5.min.js"></script> -->
<script>
uuidv5('http://example.com/hello', uuidv5.URL); // -> v5 UUID
</script>
Expand Down Expand Up @@ -167,8 +176,8 @@ Example: In-place generation of two binary IDs
```javascript
// Generate two ids in an array
const arr = new Array();
uuidv1(null, arr, 0); // ⇨ [ 59, 155, 106, 128, 117, 152, 17, 232, 146, 52, 149, 71, 47, 179, 236, 189 ]
uuidv1(null, arr, 16); // ⇨ [ 59, 155, 106, 128, 117, 152, 17, 232, 146, 52, 149, 71, 47, 179, 236, 189, 59, 155, 145, 144, 117, 152, 17, 232, 146, 52, 149, 71, 47, 179, 236, 189 ]
uuidv1(null, arr, 0); // ⇨ [ 202, 112, 178, 160, 195, 85, 17, 232, 146, 52, 151, 89, 248, 182, 98, 64 ]
uuidv1(null, arr, 16); // ⇨ [ 202, 112, 178, 160, 195, 85, 17, 232, 146, 52, 151, 89, 248, 182, 98, 64, 202, 112, 217, 176, 195, 85, 17, 232, 146, 52, 151, 89, 248, 182, 98, 64 ]

```

Expand Down Expand Up @@ -237,8 +246,8 @@ Example: Generate two IDs in a single buffer

```javascript
const buffer = new Array();
uuidv4(null, buffer, 0); // ⇨ [ 202, 18, 44, 182, 222, 65, 71, 82, 164, 80, 208, 169, 173, 93, 252, 13 ]
uuidv4(null, buffer, 16); // ⇨ [ 202, 18, 44, 182, 222, 65, 71, 82, 164, 80, 208, 169, 173, 93, 252, 13, 243, 221, 205, 191, 130, 146, 75, 199, 146, 71, 96, 195, 45, 156, 124, 9 ]
uuidv4(null, buffer, 0); // ⇨ [ 84, 49, 8, 88, 218, 86, 75, 75, 145, 208, 91, 167, 82, 45, 114, 241 ]
uuidv4(null, buffer, 16); // ⇨ [ 84, 49, 8, 88, 218, 86, 75, 75, 145, 208, 91, 167, 82, 45, 114, 241, 11, 193, 76, 131, 150, 213, 77, 128, 140, 35, 187, 29, 136, 22, 19, 118 ]

```

Expand Down
19 changes: 14 additions & 5 deletions README_js.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ uuidv5('Hello, World!', MY_NAMESPACE); // RESULT

## Quickstart - Browser-ready Versions

Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in).
Browser-ready versions of this module are available via [jsdelivr](https://www.jsdelivr.com/), [unpkg](https://unpkg.com/), and also in the `node_modules/uuid/dist` folder in npm downloads of `uuid`.

> Note that we also provide unminified versions with `.js` instead of `.min.js` file extensions if needed.

For version 1 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv1@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv1.min.js"></script>
<!-- <script src="https://unpkg.com/uuid/dist/uuidv1.min.js"></script> -->
<script>
uuidv1(); // -> v1 UUID
</script>
Expand All @@ -92,7 +95,8 @@ uuidv1(); // -> v1 UUID
For version 3 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv3@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv3.min.js"></script>
<!-- <script src="https://unpkg.com/uuid/dist/uuidv3.min.js"></script> -->
<script>
uuidv3('http://example.com/hello', uuidv3.URL); // -> v3 UUID
</script>
Expand All @@ -101,7 +105,11 @@ uuidv3('http://example.com/hello', uuidv3.URL); // -> v3 UUID
For version 4 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv4@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid"></script>
<!-- <script src="https://unpkg.com/uuid"></script> -->
<!-- you could also use this alias to lock to v4 version: -->
<!-- <script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv4.min.js"></script> -->
<!-- <script src="https://unpkg.com/uuid/dist/uuidv4.min.js"></script> -->
<script>
uuidv4(); // -> v4 UUID
</script>
Expand All @@ -110,7 +118,8 @@ uuidv4(); // -> v4 UUID
For version 5 uuids:

```html
<script src="http://wzrd.in/standalone/uuid%2Fv5@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/uuid/dist/uuidv5.min.js"></script>
<!-- <script src="https://unpkg.com/uuid/dist/uuidv5.min.js"></script> -->
<script>
uuidv5('http://example.com/hello', uuidv5.URL); // -> v5 UUID
</script>
Expand Down
Loading