uuid 3.0.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +47 -0
- package/CHANGELOG.md +57 -0
- package/LICENSE.md +1 -1
- package/README.md +207 -44
- package/README_js.md +280 -0
- package/bin/uuid +56 -17
- package/index.js +8 -0
- package/lib/bytesToUuid.js +23 -0
- package/lib/md5-browser.js +216 -0
- package/lib/md5.js +25 -0
- package/lib/rng-browser.js +19 -19
- package/lib/rng.js +7 -3
- package/lib/sha1-browser.js +89 -0
- package/lib/sha1.js +25 -0
- package/lib/v35.js +53 -0
- package/package.json +16 -8
- package/{uuid.js → v1.js} +27 -75
- package/v3.js +4 -0
- package/v4.js +29 -0
- package/v5.js +3 -0
- package/.npmignore +0 -2
- package/.travis.yml +0 -4
- package/HISTORY.md +0 -24
- package/test/mocha.opts +0 -3
- package/test/test.js +0 -96
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"browser": true,
|
|
5
|
+
"commonjs": true,
|
|
6
|
+
"node": true,
|
|
7
|
+
"mocha": true
|
|
8
|
+
},
|
|
9
|
+
"extends": ["eslint:recommended"],
|
|
10
|
+
"rules": {
|
|
11
|
+
"array-bracket-spacing": ["warn", "never"],
|
|
12
|
+
"arrow-body-style": ["warn", "as-needed"],
|
|
13
|
+
"arrow-parens": ["warn", "as-needed"],
|
|
14
|
+
"arrow-spacing": "warn",
|
|
15
|
+
"brace-style": ["warn", "1tbs"],
|
|
16
|
+
"camelcase": "warn",
|
|
17
|
+
"comma-spacing": ["warn", {"after": true}],
|
|
18
|
+
"dot-notation": "warn",
|
|
19
|
+
"eqeqeq": ["warn", "smart"],
|
|
20
|
+
"indent": ["warn", 2, {
|
|
21
|
+
"SwitchCase": 1,
|
|
22
|
+
"FunctionDeclaration": {"parameters": 1},
|
|
23
|
+
"MemberExpression": 1,
|
|
24
|
+
"CallExpression": {"arguments": 1}
|
|
25
|
+
}],
|
|
26
|
+
"key-spacing": ["warn", {"beforeColon": false, "afterColon": true, "mode": "minimum"}],
|
|
27
|
+
"keyword-spacing": "warn",
|
|
28
|
+
"no-console": "off",
|
|
29
|
+
"no-empty": "off",
|
|
30
|
+
"no-multi-spaces": "warn",
|
|
31
|
+
"no-redeclare": "off",
|
|
32
|
+
"no-restricted-globals": ["warn", "Promise"],
|
|
33
|
+
"no-trailing-spaces": "warn",
|
|
34
|
+
"no-undef": "error",
|
|
35
|
+
"no-unused-vars": ["warn", {"args": "none"}],
|
|
36
|
+
"one-var": ["warn", "never"],
|
|
37
|
+
"padded-blocks": ["warn", "never"],
|
|
38
|
+
"object-curly-spacing": ["warn", "never"],
|
|
39
|
+
"quotes": ["warn", "single"],
|
|
40
|
+
"react/prop-types": "off",
|
|
41
|
+
"react/jsx-no-bind": "off",
|
|
42
|
+
"semi": ["warn", "always"],
|
|
43
|
+
"space-before-blocks": ["warn", "always"],
|
|
44
|
+
"space-before-function-paren": ["warn", "never"],
|
|
45
|
+
"space-in-parens": ["warn", "never"]
|
|
46
|
+
}
|
|
47
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
<a name="3.2.1"></a>
|
|
6
|
+
## [3.2.1](https://github.com/kelektiv/node-uuid/compare/v3.1.0...v3.2.1) (2018-01-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* use msCrypto if available. Fixes [#241](https://github.com/kelektiv/node-uuid/issues/241) ([#247](https://github.com/kelektiv/node-uuid/issues/247)) ([1fef18b](https://github.com/kelektiv/node-uuid/commit/1fef18b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="3.2.0"></a>
|
|
16
|
+
# [3.2.0](https://github.com/kelektiv/node-uuid/compare/v3.1.0...v3.2.0) (2018-01-16)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/kelektiv/node-uuid/commit/09fa824))
|
|
22
|
+
* use msCrypto if available. Fixes [#241](https://github.com/kelektiv/node-uuid/issues/241) ([#247](https://github.com/kelektiv/node-uuid/issues/247)) ([1fef18b](https://github.com/kelektiv/node-uuid/commit/1fef18b))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* Add v3 Support ([#217](https://github.com/kelektiv/node-uuid/issues/217)) ([d94f726](https://github.com/kelektiv/node-uuid/commit/d94f726))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# 3.0.1 (2016-11-28)
|
|
32
|
+
|
|
33
|
+
* split uuid versions into separate files
|
|
34
|
+
|
|
35
|
+
# 3.0.0 (2016-11-17)
|
|
36
|
+
|
|
37
|
+
* remove .parse and .unparse
|
|
38
|
+
|
|
39
|
+
# 2.0.0
|
|
40
|
+
|
|
41
|
+
* Removed uuid.BufferClass
|
|
42
|
+
|
|
43
|
+
# 1.4.0
|
|
44
|
+
|
|
45
|
+
* Improved module context detection
|
|
46
|
+
* Removed public RNG functions
|
|
47
|
+
|
|
48
|
+
# 1.3.2
|
|
49
|
+
|
|
50
|
+
* Improve tests and handling of v1() options (Issue #24)
|
|
51
|
+
* Expose RNG option to allow for perf testing with different generators
|
|
52
|
+
|
|
53
|
+
# 1.3.0
|
|
54
|
+
|
|
55
|
+
* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
|
|
56
|
+
* Support for node.js crypto API
|
|
57
|
+
* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
|
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,47 +1,137 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
-- This file is auto-generated from README_js.md. Changes should be made there.
|
|
3
|
+
-->
|
|
4
|
+
|
|
1
5
|
# uuid [](http://travis-ci.org/kelektiv/node-uuid) #
|
|
2
6
|
|
|
3
7
|
Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.
|
|
4
8
|
|
|
5
9
|
Features:
|
|
6
10
|
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
+
* Support for version 1, 3, 4 and 5 UUIDs
|
|
12
|
+
* Cross-platform
|
|
13
|
+
* Uses cryptographically-strong random number APIs (when available)
|
|
14
|
+
* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883))
|
|
15
|
+
|
|
16
|
+
[**Deprecation warning**: The use of `require('uuid')` is deprecated and will not be
|
|
17
|
+
supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.]
|
|
11
18
|
|
|
12
|
-
## Quickstart -
|
|
19
|
+
## Quickstart - CommonJS (Recommended)
|
|
13
20
|
|
|
14
21
|
```shell
|
|
15
22
|
npm install uuid
|
|
16
23
|
```
|
|
17
24
|
|
|
25
|
+
Then generate your uuid version of choice ...
|
|
26
|
+
|
|
27
|
+
Version 1 (timestamp):
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
const uuidv1 = require('uuid/v1');
|
|
31
|
+
uuidv1(); // ⇨ 'f64f2940-fae4-11e7-8c5f-ef356f279131'
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Version 3 (namespace):
|
|
36
|
+
|
|
18
37
|
```javascript
|
|
19
|
-
const
|
|
38
|
+
const uuidv3 = require('uuid/v3');
|
|
20
39
|
|
|
21
|
-
//
|
|
22
|
-
|
|
40
|
+
// ... using predefined DNS namespace (for domain names)
|
|
41
|
+
uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
|
|
42
|
+
|
|
43
|
+
// ... using predefined URL namespace (for, well, URLs)
|
|
44
|
+
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
|
45
|
+
|
|
46
|
+
// ... using a custom namespace
|
|
47
|
+
//
|
|
48
|
+
// Note: Custom namespaces should be a UUID string specific to your application!
|
|
49
|
+
// E.g. the one here was generated using this modules `uuid` CLI.
|
|
50
|
+
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
51
|
+
uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
|
|
23
52
|
|
|
24
|
-
// Generate a v1 (time-based) id
|
|
25
|
-
uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
|
|
26
53
|
```
|
|
27
54
|
|
|
28
|
-
|
|
55
|
+
Version 4 (random):
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const uuidv4 = require('uuid/v4');
|
|
59
|
+
uuidv4(); // ⇨ '416ac246-e7ac-49ff-93b4-f7e94d997e6b'
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Version 5 (namespace):
|
|
64
|
+
|
|
65
|
+
```javascript
|
|
66
|
+
const uuidv5 = require('uuid/v5');
|
|
67
|
+
|
|
68
|
+
// ... using predefined DNS namespace (for domain names)
|
|
69
|
+
uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec'
|
|
70
|
+
|
|
71
|
+
// ... using predefined URL namespace (for, well, URLs)
|
|
72
|
+
uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
|
|
73
|
+
|
|
74
|
+
// ... using a custom namespace
|
|
75
|
+
//
|
|
76
|
+
// Note: Custom namespaces should be a UUID string specific to your application!
|
|
77
|
+
// E.g. the one here was generated using this modules `uuid` CLI.
|
|
78
|
+
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
79
|
+
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
|
80
|
+
|
|
81
|
+
```
|
|
29
82
|
|
|
30
|
-
|
|
83
|
+
## Quickstart - Browser-ready Versions
|
|
31
84
|
|
|
32
|
-
[wzrd.in](https://github.com/jfhbrook/wzrd.in)
|
|
85
|
+
Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in).
|
|
86
|
+
|
|
87
|
+
For version 1 uuids:
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<script src="http://wzrd.in/standalone/uuid%2Fv1@latest"></script>
|
|
91
|
+
<script>
|
|
92
|
+
uuidv1(); // -> v1 UUID
|
|
93
|
+
</script>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
For version 3 uuids:
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<script src="http://wzrd.in/standalone/uuid%2Fv3@latest"></script>
|
|
100
|
+
<script>
|
|
101
|
+
uuidv3('http://example.com/hello', uuidv3.URL); // -> v3 UUID
|
|
102
|
+
</script>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
For version 4 uuids:
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<script src="http://wzrd.in/standalone/uuid%2Fv4@latest"></script>
|
|
109
|
+
<script>
|
|
110
|
+
uuidv4(); // -> v4 UUID
|
|
111
|
+
</script>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
For version 5 uuids:
|
|
33
115
|
|
|
34
116
|
```html
|
|
35
|
-
<script src="
|
|
117
|
+
<script src="http://wzrd.in/standalone/uuid%2Fv5@latest"></script>
|
|
118
|
+
<script>
|
|
119
|
+
uuidv5('http://example.com/hello', uuidv5.URL); // -> v5 UUID
|
|
120
|
+
</script>
|
|
36
121
|
```
|
|
37
122
|
|
|
38
123
|
## API
|
|
39
124
|
|
|
40
|
-
###
|
|
125
|
+
### Version 1
|
|
41
126
|
|
|
42
|
-
|
|
127
|
+
```javascript
|
|
128
|
+
const uuidv1 = require('uuid/v1');
|
|
43
129
|
|
|
44
|
-
|
|
130
|
+
// Incantations
|
|
131
|
+
uuidv1();
|
|
132
|
+
uuidv1(options);
|
|
133
|
+
uuidv1(options, buffer, offset);
|
|
134
|
+
```
|
|
45
135
|
|
|
46
136
|
Generate and return a RFC4122 v1 (timestamp-based) UUID.
|
|
47
137
|
|
|
@@ -49,7 +139,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
|
|
|
49
139
|
|
|
50
140
|
* `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
|
|
51
141
|
* `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
|
|
52
|
-
* `msecs` - (Number
|
|
142
|
+
* `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used.
|
|
53
143
|
* `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.
|
|
54
144
|
|
|
55
145
|
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
@@ -57,74 +147,147 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
|
|
|
57
147
|
|
|
58
148
|
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
59
149
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
|
|
150
|
+
Note: The <node> id is generated guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.)
|
|
63
151
|
|
|
64
152
|
Example: Generate string UUID with fully-specified options
|
|
65
153
|
|
|
66
154
|
```javascript
|
|
67
|
-
|
|
155
|
+
const v1options = {
|
|
68
156
|
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
|
69
157
|
clockseq: 0x1234,
|
|
70
158
|
msecs: new Date('2011-11-01').getTime(),
|
|
71
159
|
nsecs: 5678
|
|
72
|
-
}
|
|
160
|
+
};
|
|
161
|
+
uuidv1(v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
162
|
+
|
|
73
163
|
```
|
|
74
164
|
|
|
75
165
|
Example: In-place generation of two binary IDs
|
|
76
166
|
|
|
77
167
|
```javascript
|
|
78
168
|
// Generate two ids in an array
|
|
79
|
-
const arr = new Array(
|
|
80
|
-
|
|
81
|
-
|
|
169
|
+
const arr = new Array();
|
|
170
|
+
uuidv1(null, arr, 0); // ⇨ [ 246, 87, 141, 176, 250, 228, 17, 231, 146, 52, 239, 53, 111, 39, 145, 49 ]
|
|
171
|
+
uuidv1(null, arr, 16); // ⇨ [ 246, 87, 141, 176, 250, 228, 17, 231, 146, 52, 239, 53, 111, 39, 145, 49, 246, 87, 180, 192, 250, 228, 17, 231, 146, 52, 239, 53, 111, 39, 145, 49 ]
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Version 3
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
const uuidv3 = require('uuid/v3');
|
|
82
179
|
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
180
|
+
// Incantations
|
|
181
|
+
uuidv3(name, namespace);
|
|
182
|
+
uuidv3(name, namespace, buffer);
|
|
183
|
+
uuidv3(name, namespace, buffer, offset);
|
|
86
184
|
```
|
|
87
185
|
|
|
88
|
-
|
|
186
|
+
Generate and return a RFC4122 v3 UUID.
|
|
187
|
+
|
|
188
|
+
* `name` - (String | Array[]) "name" to create UUID with
|
|
189
|
+
* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
190
|
+
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
191
|
+
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
192
|
+
|
|
193
|
+
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
194
|
+
|
|
195
|
+
Example:
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424'
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Version 4
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
const uuidv4 = require('uuid/v4')
|
|
206
|
+
|
|
207
|
+
// Incantations
|
|
208
|
+
uuidv4();
|
|
209
|
+
uuidv4(options);
|
|
210
|
+
uuidv4(options, buffer, offset);
|
|
211
|
+
```
|
|
89
212
|
|
|
90
213
|
Generate and return a RFC4122 v4 UUID.
|
|
91
214
|
|
|
92
215
|
* `options` - (Object) Optional uuid state to apply. Properties may include:
|
|
93
|
-
|
|
94
216
|
* `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values
|
|
95
|
-
* `rng` - (Function) Random # generator
|
|
96
|
-
|
|
217
|
+
* `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255)
|
|
97
218
|
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
98
219
|
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
|
99
220
|
|
|
100
221
|
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
101
222
|
|
|
102
|
-
Example: Generate string UUID with
|
|
223
|
+
Example: Generate string UUID with predefined `random` values
|
|
103
224
|
|
|
104
225
|
```javascript
|
|
105
|
-
|
|
226
|
+
const v4options = {
|
|
106
227
|
random: [
|
|
107
228
|
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
|
|
108
229
|
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
|
|
109
230
|
]
|
|
110
|
-
}
|
|
111
|
-
//
|
|
231
|
+
};
|
|
232
|
+
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
233
|
+
|
|
112
234
|
```
|
|
113
235
|
|
|
114
236
|
Example: Generate two IDs in a single buffer
|
|
115
237
|
|
|
116
238
|
```javascript
|
|
117
|
-
const buffer = new Array(
|
|
118
|
-
|
|
119
|
-
|
|
239
|
+
const buffer = new Array();
|
|
240
|
+
uuidv4(null, buffer, 0); // ⇨ [ 175, 10, 162, 184, 217, 255, 77, 139, 161, 80, 41, 200, 70, 238, 196, 250 ]
|
|
241
|
+
uuidv4(null, buffer, 16); // ⇨ [ 175, 10, 162, 184, 217, 255, 77, 139, 161, 80, 41, 200, 70, 238, 196, 250, 75, 162, 105, 153, 48, 238, 77, 58, 169, 56, 158, 207, 106, 160, 47, 239 ]
|
|
242
|
+
|
|
120
243
|
```
|
|
121
244
|
|
|
122
|
-
|
|
245
|
+
### Version 5
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
const uuidv5 = require('uuid/v5');
|
|
123
249
|
|
|
250
|
+
// Incantations
|
|
251
|
+
uuidv5(name, namespace);
|
|
252
|
+
uuidv5(name, namespace, buffer);
|
|
253
|
+
uuidv5(name, namespace, buffer, offset);
|
|
124
254
|
```
|
|
125
|
-
|
|
255
|
+
|
|
256
|
+
Generate and return a RFC4122 v5 UUID.
|
|
257
|
+
|
|
258
|
+
* `name` - (String | Array[]) "name" to create UUID with
|
|
259
|
+
* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
260
|
+
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
261
|
+
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
262
|
+
|
|
263
|
+
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
264
|
+
|
|
265
|
+
Example:
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b'
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Command Line
|
|
273
|
+
|
|
274
|
+
UUIDs can be generated from the command line with the `uuid` command.
|
|
275
|
+
|
|
276
|
+
```shell
|
|
277
|
+
$ uuid
|
|
278
|
+
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
|
279
|
+
|
|
280
|
+
$ uuid v1
|
|
281
|
+
02d37060-d446-11e7-a9fa-7bdae751ebe1
|
|
126
282
|
```
|
|
127
283
|
|
|
128
|
-
|
|
284
|
+
Type `uuid --help` for usage details
|
|
285
|
+
|
|
286
|
+
## Testing
|
|
287
|
+
|
|
288
|
+
```shell
|
|
289
|
+
npm test
|
|
290
|
+
```
|
|
129
291
|
|
|
130
|
-
|
|
292
|
+
----
|
|
293
|
+
Markdown generated from [README_js.md](README_js.md) by [](https://github.com/broofa/runmd)
|