uuid 3.3.2 → 7.0.0
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/CHANGELOG.md +74 -49
- package/CONTRIBUTING.md +20 -0
- package/README.md +246 -156
- package/dist/bin/uuid +2 -0
- package/dist/bytesToUuid.js +27 -0
- package/dist/esm-browser/bytesToUuid.js +18 -0
- package/dist/esm-browser/index.js +4 -0
- package/{lib/md5-browser.js → dist/esm-browser/md5.js} +53 -51
- package/dist/esm-browser/rng.js +15 -0
- package/dist/esm-browser/sha1.js +91 -0
- package/dist/esm-browser/v1.js +95 -0
- package/dist/esm-browser/v3.js +4 -0
- package/{lib → dist/esm-browser}/v35.js +21 -22
- package/dist/esm-browser/v4.js +27 -0
- package/dist/esm-browser/v5.js +4 -0
- package/dist/index.js +39 -0
- package/dist/md5.js +24 -0
- package/dist/rng.js +16 -0
- package/dist/sha1.js +24 -0
- package/dist/umd/uuid.min.js +1 -0
- package/dist/umd/uuidv1.min.js +1 -0
- package/dist/umd/uuidv3.min.js +1 -0
- package/dist/umd/uuidv4.min.js +1 -0
- package/dist/umd/uuidv5.min.js +1 -0
- package/dist/uuid-bin.js +67 -0
- package/dist/v1.js +108 -0
- package/dist/v3.js +17 -0
- package/dist/v35.js +69 -0
- package/dist/v4.js +41 -0
- package/dist/v5.js +17 -0
- package/package.json +79 -19
- package/v1.js +6 -107
- package/v3.js +7 -3
- package/v4.js +6 -27
- package/v5.js +8 -3
- package/.eslintrc.json +0 -47
- package/AUTHORS +0 -5
- package/README_js.md +0 -280
- package/bin/uuid +0 -65
- package/index.js +0 -8
- package/lib/bytesToUuid.js +0 -24
- package/lib/md5.js +0 -25
- package/lib/rng-browser.js +0 -34
- package/lib/rng.js +0 -8
- package/lib/sha1-browser.js +0 -89
- package/lib/sha1.js +0 -25
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r=r||self).uuidv3=n()}(this,(function(){"use strict";for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);function t(r,n){var t=(65535&r)+(65535&n);return(r>>16)+(n>>16)+(t>>16)<<16|65535&t}function e(r,n,e,o,a,u){return t((f=t(t(n,r),t(o,u)))<<(c=a)|f>>>32-c,e);var f,c}function o(r,n,t,o,a,u,f){return e(n&t|~n&o,r,n,a,u,f)}function a(r,n,t,o,a,u,f){return e(n&o|t&~o,r,n,a,u,f)}function u(r,n,t,o,a,u,f){return e(n^t^o,r,n,a,u,f)}function f(r,n,t,o,a,u,f){return e(t^(n|~o),r,n,a,u,f)}return function(n,t,e){var o=function(n,o,a,u){var f=a&&u||0;if("string"==typeof n&&(n=function(r){r=unescape(encodeURIComponent(r));for(var n=new Array(r.length),t=0;t<r.length;t++)n[t]=r.charCodeAt(t);return n}(n)),"string"==typeof o&&(o=function(r){var n=[];return r.replace(/[a-fA-F0-9]{2}/g,(function(r){n.push(parseInt(r,16))})),n}(o)),!Array.isArray(n))throw TypeError("value must be an array of bytes");if(!Array.isArray(o)||16!==o.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var c=e(o.concat(n));if(c[6]=15&c[6]|t,c[8]=63&c[8]|128,a)for(var i=0;i<16;++i)a[f+i]=c[i];return a||function(n,t){var e=t||0,o=r;return[o[n[e++]],o[n[e++]],o[n[e++]],o[n[e++]],"-",o[n[e++]],o[n[e++]],"-",o[n[e++]],o[n[e++]],"-",o[n[e++]],o[n[e++]],"-",o[n[e++]],o[n[e++]],o[n[e++]],o[n[e++]],o[n[e++]],o[n[e++]]].join("")}(c)};try{o.name=n}catch(r){}return o.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",o.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",o}("v3",48,(function(r){if("string"==typeof r){var n=unescape(encodeURIComponent(r));r=new Array(n.length);for(var e=0;e<n.length;e++)r[e]=n.charCodeAt(e)}return function(r){var n,t,e,o=[],a=32*r.length;for(n=0;n<a;n+=8)t=r[n>>5]>>>n%32&255,e=parseInt("0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t),16),o.push(e);return o}(function(r,n){var e,c,i,d,s;r[n>>5]|=128<<n%32,r[14+(n+64>>>9<<4)]=n;var v=1732584193,h=-271733879,p=-1732584194,y=271733878;for(e=0;e<r.length;e+=16)c=v,i=h,d=p,s=y,v=o(v,h,p,y,r[e],7,-680876936),y=o(y,v,h,p,r[e+1],12,-389564586),p=o(p,y,v,h,r[e+2],17,606105819),h=o(h,p,y,v,r[e+3],22,-1044525330),v=o(v,h,p,y,r[e+4],7,-176418897),y=o(y,v,h,p,r[e+5],12,1200080426),p=o(p,y,v,h,r[e+6],17,-1473231341),h=o(h,p,y,v,r[e+7],22,-45705983),v=o(v,h,p,y,r[e+8],7,1770035416),y=o(y,v,h,p,r[e+9],12,-1958414417),p=o(p,y,v,h,r[e+10],17,-42063),h=o(h,p,y,v,r[e+11],22,-1990404162),v=o(v,h,p,y,r[e+12],7,1804603682),y=o(y,v,h,p,r[e+13],12,-40341101),p=o(p,y,v,h,r[e+14],17,-1502002290),h=o(h,p,y,v,r[e+15],22,1236535329),v=a(v,h,p,y,r[e+1],5,-165796510),y=a(y,v,h,p,r[e+6],9,-1069501632),p=a(p,y,v,h,r[e+11],14,643717713),h=a(h,p,y,v,r[e],20,-373897302),v=a(v,h,p,y,r[e+5],5,-701558691),y=a(y,v,h,p,r[e+10],9,38016083),p=a(p,y,v,h,r[e+15],14,-660478335),h=a(h,p,y,v,r[e+4],20,-405537848),v=a(v,h,p,y,r[e+9],5,568446438),y=a(y,v,h,p,r[e+14],9,-1019803690),p=a(p,y,v,h,r[e+3],14,-187363961),h=a(h,p,y,v,r[e+8],20,1163531501),v=a(v,h,p,y,r[e+13],5,-1444681467),y=a(y,v,h,p,r[e+2],9,-51403784),p=a(p,y,v,h,r[e+7],14,1735328473),h=a(h,p,y,v,r[e+12],20,-1926607734),v=u(v,h,p,y,r[e+5],4,-378558),y=u(y,v,h,p,r[e+8],11,-2022574463),p=u(p,y,v,h,r[e+11],16,1839030562),h=u(h,p,y,v,r[e+14],23,-35309556),v=u(v,h,p,y,r[e+1],4,-1530992060),y=u(y,v,h,p,r[e+4],11,1272893353),p=u(p,y,v,h,r[e+7],16,-155497632),h=u(h,p,y,v,r[e+10],23,-1094730640),v=u(v,h,p,y,r[e+13],4,681279174),y=u(y,v,h,p,r[e],11,-358537222),p=u(p,y,v,h,r[e+3],16,-722521979),h=u(h,p,y,v,r[e+6],23,76029189),v=u(v,h,p,y,r[e+9],4,-640364487),y=u(y,v,h,p,r[e+12],11,-421815835),p=u(p,y,v,h,r[e+15],16,530742520),h=u(h,p,y,v,r[e+2],23,-995338651),v=f(v,h,p,y,r[e],6,-198630844),y=f(y,v,h,p,r[e+7],10,1126891415),p=f(p,y,v,h,r[e+14],15,-1416354905),h=f(h,p,y,v,r[e+5],21,-57434055),v=f(v,h,p,y,r[e+12],6,1700485571),y=f(y,v,h,p,r[e+3],10,-1894986606),p=f(p,y,v,h,r[e+10],15,-1051523),h=f(h,p,y,v,r[e+1],21,-2054922799),v=f(v,h,p,y,r[e+8],6,1873313359),y=f(y,v,h,p,r[e+15],10,-30611744),p=f(p,y,v,h,r[e+6],15,-1560198380),h=f(h,p,y,v,r[e+13],21,1309151649),v=f(v,h,p,y,r[e+4],6,-145523070),y=f(y,v,h,p,r[e+11],10,-1120210379),p=f(p,y,v,h,r[e+2],15,718787259),h=f(h,p,y,v,r[e+9],21,-343485551),v=t(v,c),h=t(h,i),p=t(p,d),y=t(y,s);return[v,h,p,y]}(function(r){var n,t=[];for(t[(r.length>>2)-1]=void 0,n=0;n<t.length;n+=1)t[n]=0;var e=8*r.length;for(n=0;n<e;n+=8)t[n>>5]|=(255&r[n/8])<<n%32;return t}(r),8*r.length))}))}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(o,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(o=o||self).uuidv4=e()}(this,(function(){"use strict";var o="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),e=new Uint8Array(16);function r(){if(!o)throw new Error("uuid: This browser does not seem to support crypto.getRandomValues(). If you need to support this browser, please provide a custom random number generator through options.rng.");return o(e)}for(var n=[],t=0;t<256;++t)n[t]=(t+256).toString(16).substr(1);return function(o,e,t){var u=e&&t||0;"string"==typeof o&&(e="binary"===o?new Array(16):null,o=null);var i=(o=o||{}).random||(o.rng||r)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var s=0;s<16;++s)e[u+s]=i[s];return e||function(o,e){var r=e||0,t=n;return[t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],"-",t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]],t[o[r++]]].join("")}(i)}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r=r||self).uuidv5=e()}(this,(function(){"use strict";for(var r=[],e=0;e<256;++e)r[e]=(e+256).toString(16).substr(1);function n(r,e,n,t){switch(r){case 0:return e&n^~e&t;case 1:return e^n^t;case 2:return e&n^e&t^n&t;case 3:return e^n^t}}function t(r,e){return r<<e|r>>>32-e}return function(e,n,t){var a=function(e,a,o,f){var u=o&&f||0;if("string"==typeof e&&(e=function(r){r=unescape(encodeURIComponent(r));for(var e=new Array(r.length),n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e}(e)),"string"==typeof a&&(a=function(r){var e=[];return r.replace(/[a-fA-F0-9]{2}/g,(function(r){e.push(parseInt(r,16))})),e}(a)),!Array.isArray(e))throw TypeError("value must be an array of bytes");if(!Array.isArray(a)||16!==a.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var c=t(a.concat(e));if(c[6]=15&c[6]|n,c[8]=63&c[8]|128,o)for(var i=0;i<16;++i)o[u+i]=c[i];return o||function(e,n){var t=n||0,a=r;return[a[e[t++]],a[e[t++]],a[e[t++]],a[e[t++]],"-",a[e[t++]],a[e[t++]],"-",a[e[t++]],a[e[t++]],"-",a[e[t++]],a[e[t++]],"-",a[e[t++]],a[e[t++]],a[e[t++]],a[e[t++]],a[e[t++]],a[e[t++]]].join("")}(c)};try{a.name=e}catch(r){}return a.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",a.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",a}("v5",80,(function(r){var e=[1518500249,1859775393,2400959708,3395469782],a=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof r){var o=unescape(encodeURIComponent(r));r=new Array(o.length);for(var f=0;f<o.length;f++)r[f]=o.charCodeAt(f)}r.push(128);var u=r.length/4+2,c=Math.ceil(u/16),i=new Array(c);for(f=0;f<c;f++){i[f]=new Array(16);for(var s=0;s<16;s++)i[f][s]=r[64*f+4*s]<<24|r[64*f+4*s+1]<<16|r[64*f+4*s+2]<<8|r[64*f+4*s+3]}for(i[c-1][14]=8*(r.length-1)/Math.pow(2,32),i[c-1][14]=Math.floor(i[c-1][14]),i[c-1][15]=8*(r.length-1)&4294967295,f=0;f<c;f++){for(var d=new Array(80),y=0;y<16;y++)d[y]=i[f][y];for(y=16;y<80;y++)d[y]=t(d[y-3]^d[y-8]^d[y-14]^d[y-16],1);var h=a[0],p=a[1],v=a[2],l=a[3],g=a[4];for(y=0;y<80;y++){var A=Math.floor(y/20),b=t(h,5)+n(A,p,v,l)+g+e[A]+d[y]>>>0;g=l,l=v,v=t(p,30)>>>0,p=h,h=b}a[0]=a[0]+h>>>0,a[1]=a[1]+p>>>0,a[2]=a[2]+v>>>0,a[3]=a[3]+l>>>0,a[4]=a[4]+g>>>0}return[a[0]>>24&255,a[0]>>16&255,a[0]>>8&255,255&a[0],a[1]>>24&255,a[1]>>16&255,a[1]>>8&255,255&a[1],a[2]>>24&255,a[2]>>16&255,a[2]>>8&255,255&a[2],a[3]>>24&255,a[3]>>16&255,a[3]>>8&255,255&a[3],a[4]>>24&255,a[4]>>16&255,a[4]>>8&255,255&a[4]]}))}));
|
package/dist/uuid-bin.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _assert = _interopRequireDefault(require("assert"));
|
|
4
|
+
|
|
5
|
+
var _v = _interopRequireDefault(require("./v1.js"));
|
|
6
|
+
|
|
7
|
+
var _v2 = _interopRequireDefault(require("./v3.js"));
|
|
8
|
+
|
|
9
|
+
var _v3 = _interopRequireDefault(require("./v4.js"));
|
|
10
|
+
|
|
11
|
+
var _v4 = _interopRequireDefault(require("./v5.js"));
|
|
12
|
+
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
15
|
+
function usage() {
|
|
16
|
+
console.log('Usage:');
|
|
17
|
+
console.log(' uuid');
|
|
18
|
+
console.log(' uuid v1');
|
|
19
|
+
console.log(' uuid v3 <name> <namespace uuid>');
|
|
20
|
+
console.log(' uuid v4');
|
|
21
|
+
console.log(' uuid v5 <name> <namespace uuid>');
|
|
22
|
+
console.log(' uuid --help');
|
|
23
|
+
console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var args = process.argv.slice(2);
|
|
27
|
+
|
|
28
|
+
if (args.indexOf('--help') >= 0) {
|
|
29
|
+
usage();
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var version = args.shift() || 'v4';
|
|
34
|
+
|
|
35
|
+
switch (version) {
|
|
36
|
+
case 'v1':
|
|
37
|
+
console.log((0, _v.default)());
|
|
38
|
+
break;
|
|
39
|
+
|
|
40
|
+
case 'v3':
|
|
41
|
+
var name = args.shift();
|
|
42
|
+
var namespace = args.shift();
|
|
43
|
+
(0, _assert.default)(name != null, 'v3 name not specified');
|
|
44
|
+
(0, _assert.default)(namespace != null, 'v3 namespace not specified');
|
|
45
|
+
if (namespace === 'URL') namespace = _v2.default.URL;
|
|
46
|
+
if (namespace === 'DNS') namespace = _v2.default.DNS;
|
|
47
|
+
console.log((0, _v2.default)(name, namespace));
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 'v4':
|
|
51
|
+
console.log((0, _v3.default)());
|
|
52
|
+
break;
|
|
53
|
+
|
|
54
|
+
case 'v5':
|
|
55
|
+
var name = args.shift();
|
|
56
|
+
var namespace = args.shift();
|
|
57
|
+
(0, _assert.default)(name != null, 'v5 name not specified');
|
|
58
|
+
(0, _assert.default)(namespace != null, 'v5 namespace not specified');
|
|
59
|
+
if (namespace === 'URL') namespace = _v4.default.URL;
|
|
60
|
+
if (namespace === 'DNS') namespace = _v4.default.DNS;
|
|
61
|
+
console.log((0, _v4.default)(name, namespace));
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
default:
|
|
65
|
+
usage();
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
package/dist/v1.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _rng = _interopRequireDefault(require("./rng.js"));
|
|
9
|
+
|
|
10
|
+
var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
// **`v1()` - Generate time-based UUID**
|
|
15
|
+
//
|
|
16
|
+
// Inspired by https://github.com/LiosK/UUID.js
|
|
17
|
+
// and http://docs.python.org/library/uuid.html
|
|
18
|
+
var _nodeId;
|
|
19
|
+
|
|
20
|
+
var _clockseq; // Previous uuid creation time
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _lastMSecs = 0;
|
|
24
|
+
var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
|
|
25
|
+
|
|
26
|
+
function v1(options, buf, offset) {
|
|
27
|
+
var i = buf && offset || 0;
|
|
28
|
+
var b = buf || [];
|
|
29
|
+
options = options || {};
|
|
30
|
+
var node = options.node || _nodeId;
|
|
31
|
+
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
|
32
|
+
// specified. We do this lazily to minimize issues related to insufficient
|
|
33
|
+
// system entropy. See #189
|
|
34
|
+
|
|
35
|
+
if (node == null || clockseq == null) {
|
|
36
|
+
var seedBytes = options.random || (options.rng || _rng.default)();
|
|
37
|
+
|
|
38
|
+
if (node == null) {
|
|
39
|
+
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
40
|
+
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (clockseq == null) {
|
|
44
|
+
// Per 4.2.2, randomize (14 bit) clockseq
|
|
45
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
46
|
+
}
|
|
47
|
+
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
48
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
49
|
+
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
50
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); // Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
54
|
+
// cycle to simulate higher resolution clock
|
|
55
|
+
|
|
56
|
+
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
|
|
57
|
+
|
|
58
|
+
var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
|
59
|
+
|
|
60
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
61
|
+
clockseq = clockseq + 1 & 0x3fff;
|
|
62
|
+
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
63
|
+
// time interval
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
67
|
+
nsecs = 0;
|
|
68
|
+
} // Per 4.2.1.2 Throw error if too many uuids are requested
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (nsecs >= 10000) {
|
|
72
|
+
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_lastMSecs = msecs;
|
|
76
|
+
_lastNSecs = nsecs;
|
|
77
|
+
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
78
|
+
|
|
79
|
+
msecs += 12219292800000; // `time_low`
|
|
80
|
+
|
|
81
|
+
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
82
|
+
b[i++] = tl >>> 24 & 0xff;
|
|
83
|
+
b[i++] = tl >>> 16 & 0xff;
|
|
84
|
+
b[i++] = tl >>> 8 & 0xff;
|
|
85
|
+
b[i++] = tl & 0xff; // `time_mid`
|
|
86
|
+
|
|
87
|
+
var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
|
88
|
+
b[i++] = tmh >>> 8 & 0xff;
|
|
89
|
+
b[i++] = tmh & 0xff; // `time_high_and_version`
|
|
90
|
+
|
|
91
|
+
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
92
|
+
|
|
93
|
+
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
94
|
+
|
|
95
|
+
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
|
|
96
|
+
|
|
97
|
+
b[i++] = clockseq & 0xff; // `node`
|
|
98
|
+
|
|
99
|
+
for (var n = 0; n < 6; ++n) {
|
|
100
|
+
b[i + n] = node[n];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return buf ? buf : (0, _bytesToUuid.default)(b);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var _default = v1;
|
|
107
|
+
exports.default = _default;
|
|
108
|
+
module.exports = exports.default;
|
package/dist/v3.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _v = _interopRequireDefault(require("./v35.js"));
|
|
9
|
+
|
|
10
|
+
var _md = _interopRequireDefault(require("./md5.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
15
|
+
var _default = v3;
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
module.exports = exports.default;
|
package/dist/v35.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
exports.URL = exports.DNS = void 0;
|
|
8
|
+
|
|
9
|
+
var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
|
|
13
|
+
function uuidToBytes(uuid) {
|
|
14
|
+
// Note: We assume we're being passed a valid uuid string
|
|
15
|
+
var bytes = [];
|
|
16
|
+
uuid.replace(/[a-fA-F0-9]{2}/g, function (hex) {
|
|
17
|
+
bytes.push(parseInt(hex, 16));
|
|
18
|
+
});
|
|
19
|
+
return bytes;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function stringToBytes(str) {
|
|
23
|
+
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
24
|
+
|
|
25
|
+
var bytes = new Array(str.length);
|
|
26
|
+
|
|
27
|
+
for (var i = 0; i < str.length; i++) {
|
|
28
|
+
bytes[i] = str.charCodeAt(i);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return bytes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
35
|
+
exports.DNS = DNS;
|
|
36
|
+
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
37
|
+
exports.URL = URL;
|
|
38
|
+
|
|
39
|
+
function _default(name, version, hashfunc) {
|
|
40
|
+
var generateUUID = function (value, namespace, buf, offset) {
|
|
41
|
+
var off = buf && offset || 0;
|
|
42
|
+
if (typeof value == 'string') value = stringToBytes(value);
|
|
43
|
+
if (typeof namespace == 'string') namespace = uuidToBytes(namespace);
|
|
44
|
+
if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');
|
|
45
|
+
if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values'); // Per 4.3
|
|
46
|
+
|
|
47
|
+
var bytes = hashfunc(namespace.concat(value));
|
|
48
|
+
bytes[6] = bytes[6] & 0x0f | version;
|
|
49
|
+
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
50
|
+
|
|
51
|
+
if (buf) {
|
|
52
|
+
for (var idx = 0; idx < 16; ++idx) {
|
|
53
|
+
buf[off + idx] = bytes[idx];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return buf || (0, _bytesToUuid.default)(bytes);
|
|
58
|
+
}; // Function#name is not settable on some platforms (#270)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
generateUUID.name = name;
|
|
63
|
+
} catch (err) {} // For CommonJS default export support
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
generateUUID.DNS = DNS;
|
|
67
|
+
generateUUID.URL = URL;
|
|
68
|
+
return generateUUID;
|
|
69
|
+
}
|
package/dist/v4.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _rng = _interopRequireDefault(require("./rng.js"));
|
|
9
|
+
|
|
10
|
+
var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
function v4(options, buf, offset) {
|
|
15
|
+
var i = buf && offset || 0;
|
|
16
|
+
|
|
17
|
+
if (typeof options == 'string') {
|
|
18
|
+
buf = options === 'binary' ? new Array(16) : null;
|
|
19
|
+
options = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
options = options || {};
|
|
23
|
+
|
|
24
|
+
var rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
28
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
29
|
+
|
|
30
|
+
if (buf) {
|
|
31
|
+
for (var ii = 0; ii < 16; ++ii) {
|
|
32
|
+
buf[i + ii] = rnds[ii];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return buf || (0, _bytesToUuid.default)(rnds);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var _default = v4;
|
|
40
|
+
exports.default = _default;
|
|
41
|
+
module.exports = exports.default;
|
package/dist/v5.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _v = _interopRequireDefault(require("./v35.js"));
|
|
9
|
+
|
|
10
|
+
var _sha = _interopRequireDefault(require("./sha1.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
15
|
+
var _default = v5;
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
module.exports = exports.default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uuid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
|
5
5
|
"commitlint": {
|
|
6
6
|
"extends": [
|
|
@@ -14,31 +14,91 @@
|
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"bin": {
|
|
17
|
-
"uuid": "
|
|
17
|
+
"uuid": "dist/bin/uuid"
|
|
18
18
|
},
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"module": "dist/esm-browser/index.js",
|
|
22
|
+
"files": [
|
|
23
|
+
"CHANGELOG.md",
|
|
24
|
+
"CONTRIBUTING.md",
|
|
25
|
+
"LICENSE.md",
|
|
26
|
+
"README.md",
|
|
27
|
+
"dist",
|
|
28
|
+
"v1.js",
|
|
29
|
+
"v3.js",
|
|
30
|
+
"v4.js",
|
|
31
|
+
"v5.js"
|
|
32
|
+
],
|
|
19
33
|
"devDependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
34
|
+
"@babel/cli": "7.8.4",
|
|
35
|
+
"@babel/core": "7.8.4",
|
|
36
|
+
"@babel/preset-env": "7.8.4",
|
|
37
|
+
"@commitlint/cli": "8.3.5",
|
|
38
|
+
"@commitlint/config-conventional": "8.3.4",
|
|
39
|
+
"babel-eslint": "10.0.3",
|
|
40
|
+
"babel-plugin-add-module-exports": "1.0.2",
|
|
41
|
+
"browserstack-local": "1.4.5",
|
|
42
|
+
"bundlewatch": "0.2.5",
|
|
43
|
+
"eslint": "6.8.0",
|
|
44
|
+
"eslint-config-prettier": "6.10.0",
|
|
45
|
+
"eslint-plugin-prettier": "3.1.2",
|
|
46
|
+
"esm": "3.2.25",
|
|
47
|
+
"http-server": "0.12.1",
|
|
48
|
+
"husky": "3.0.9",
|
|
49
|
+
"jest": "25.1.0",
|
|
50
|
+
"lint-staged": "10.0.7",
|
|
51
|
+
"npm-run-all": "4.1.5",
|
|
52
|
+
"prettier": "1.19.1",
|
|
53
|
+
"rollup": "1.31.1",
|
|
54
|
+
"rollup-plugin-terser": "5.2.0",
|
|
55
|
+
"runmd": "1.3.2",
|
|
56
|
+
"selenium-webdriver": "3.6.0",
|
|
57
|
+
"standard-version": "7.1.0"
|
|
27
58
|
},
|
|
28
59
|
"scripts": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
60
|
+
"examples:browser-webpack:build": "cd examples/browser-webpack && npm install && npm run build",
|
|
61
|
+
"examples:browser-rollup:build": "cd examples/browser-rollup && npm install && npm run build",
|
|
62
|
+
"examples:browser-esmodules:build": "cd examples/browser-esmodules && npm install && npm run build",
|
|
63
|
+
"lint": "npm run eslint:check && npm run prettier:check",
|
|
64
|
+
"eslint:check": "eslint src/ test/ examples/ *.js",
|
|
65
|
+
"eslint:fix": "eslint --fix src/ test/ examples/ *.js",
|
|
66
|
+
"pretest": "npm run build",
|
|
67
|
+
"test": "BABEL_ENV=commonjs node --throw-deprecation node_modules/.bin/jest test/unit/",
|
|
68
|
+
"pretest:browser": "npm run build && npm-run-all --parallel examples:**",
|
|
69
|
+
"test:browser": "BABEL_ENV=commonjs jest --forceExit --verbose test/browser/${BROWSER:-}*",
|
|
70
|
+
"prettier:check": "prettier --ignore-path .prettierignore --check '**/*.{js,jsx,json,md}'",
|
|
71
|
+
"prettier:fix": "prettier --ignore-path .prettierignore --write '**/*.{js,jsx,json,md}'",
|
|
72
|
+
"ci": "npm run lint && npm run test && npm run prettier:check && npm run docs:diff && npm run bundlewatch",
|
|
73
|
+
"bundlewatch": "( node --version | grep -vq 'v12' ) || ( npm run pretest:browser && CI_REPO_OWNER=uuidjs CI_REPO_NAME=uuid CI_COMMIT_SHA=$GITHUB_SHA CI_BRANCH=${GITHUB_REF##refs/heads/} bundlewatch --config bundlewatch.config.json )",
|
|
31
74
|
"md": "runmd --watch --output=README.md README_js.md",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"./lib/rng.js": "./lib/rng-browser.js",
|
|
37
|
-
"./lib/sha1.js": "./lib/sha1-browser.js",
|
|
38
|
-
"./lib/md5.js": "./lib/md5-browser.js"
|
|
75
|
+
"docs": "( node --version | grep -q 'v12' ) && ( npm run build && runmd --output=README.md README_js.md )",
|
|
76
|
+
"docs:diff": "( node --version | grep -vq 'v12' ) || ( npm run docs && git diff --quiet README.md )",
|
|
77
|
+
"build": "./scripts/build.sh",
|
|
78
|
+
"release": "standard-version --no-verify"
|
|
39
79
|
},
|
|
40
80
|
"repository": {
|
|
41
81
|
"type": "git",
|
|
42
|
-
"url": "https://github.com/
|
|
82
|
+
"url": "https://github.com/uuidjs/uuid.git"
|
|
83
|
+
},
|
|
84
|
+
"husky": {
|
|
85
|
+
"hooks": {
|
|
86
|
+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
87
|
+
"pre-commit": "lint-staged"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"lint-staged": {
|
|
91
|
+
"*.{js,jsx,json,md}": [
|
|
92
|
+
"prettier --write"
|
|
93
|
+
],
|
|
94
|
+
"*.{js,jsx}": [
|
|
95
|
+
"eslint --fix"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"standard-version": {
|
|
99
|
+
"scripts": {
|
|
100
|
+
"postchangelog": "prettier --write CHANGELOG.md",
|
|
101
|
+
"postcommit": "npm run build"
|
|
102
|
+
}
|
|
43
103
|
}
|
|
44
104
|
}
|
package/v1.js
CHANGED
|
@@ -1,109 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var bytesToUuid = require('./lib/bytesToUuid');
|
|
1
|
+
const util = require('util');
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
// Inspired by https://github.com/LiosK/UUID.js
|
|
7
|
-
// and http://docs.python.org/library/uuid.html
|
|
3
|
+
const v1 = require('./dist/v1.js');
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _lastMSecs = 0;
|
|
14
|
-
var _lastNSecs = 0;
|
|
15
|
-
|
|
16
|
-
// See https://github.com/broofa/node-uuid for API details
|
|
17
|
-
function v1(options, buf, offset) {
|
|
18
|
-
var i = buf && offset || 0;
|
|
19
|
-
var b = buf || [];
|
|
20
|
-
|
|
21
|
-
options = options || {};
|
|
22
|
-
var node = options.node || _nodeId;
|
|
23
|
-
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
24
|
-
|
|
25
|
-
// node and clockseq need to be initialized to random values if they're not
|
|
26
|
-
// specified. We do this lazily to minimize issues related to insufficient
|
|
27
|
-
// system entropy. See #189
|
|
28
|
-
if (node == null || clockseq == null) {
|
|
29
|
-
var seedBytes = rng();
|
|
30
|
-
if (node == null) {
|
|
31
|
-
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
32
|
-
node = _nodeId = [
|
|
33
|
-
seedBytes[0] | 0x01,
|
|
34
|
-
seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
if (clockseq == null) {
|
|
38
|
-
// Per 4.2.2, randomize (14 bit) clockseq
|
|
39
|
-
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
44
|
-
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
45
|
-
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
46
|
-
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
47
|
-
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
|
|
48
|
-
|
|
49
|
-
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
50
|
-
// cycle to simulate higher resolution clock
|
|
51
|
-
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
52
|
-
|
|
53
|
-
// Time since last uuid creation (in msecs)
|
|
54
|
-
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
|
55
|
-
|
|
56
|
-
// Per 4.2.1.2, Bump clockseq on clock regression
|
|
57
|
-
if (dt < 0 && options.clockseq === undefined) {
|
|
58
|
-
clockseq = clockseq + 1 & 0x3fff;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
62
|
-
// time interval
|
|
63
|
-
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
64
|
-
nsecs = 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Per 4.2.1.2 Throw error if too many uuids are requested
|
|
68
|
-
if (nsecs >= 10000) {
|
|
69
|
-
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
_lastMSecs = msecs;
|
|
73
|
-
_lastNSecs = nsecs;
|
|
74
|
-
_clockseq = clockseq;
|
|
75
|
-
|
|
76
|
-
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
77
|
-
msecs += 12219292800000;
|
|
78
|
-
|
|
79
|
-
// `time_low`
|
|
80
|
-
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
81
|
-
b[i++] = tl >>> 24 & 0xff;
|
|
82
|
-
b[i++] = tl >>> 16 & 0xff;
|
|
83
|
-
b[i++] = tl >>> 8 & 0xff;
|
|
84
|
-
b[i++] = tl & 0xff;
|
|
85
|
-
|
|
86
|
-
// `time_mid`
|
|
87
|
-
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
|
88
|
-
b[i++] = tmh >>> 8 & 0xff;
|
|
89
|
-
b[i++] = tmh & 0xff;
|
|
90
|
-
|
|
91
|
-
// `time_high_and_version`
|
|
92
|
-
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
93
|
-
b[i++] = tmh >>> 16 & 0xff;
|
|
94
|
-
|
|
95
|
-
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
96
|
-
b[i++] = clockseq >>> 8 | 0x80;
|
|
97
|
-
|
|
98
|
-
// `clock_seq_low`
|
|
99
|
-
b[i++] = clockseq & 0xff;
|
|
100
|
-
|
|
101
|
-
// `node`
|
|
102
|
-
for (var n = 0; n < 6; ++n) {
|
|
103
|
-
b[i + n] = node[n];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return buf ? buf : bytesToUuid(b);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
module.exports = v1;
|
|
5
|
+
module.exports = util.deprecate(
|
|
6
|
+
v1,
|
|
7
|
+
"Deep requiring like `const uuidv1 = require('uuid/v1');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v3x-of-this-module for more information.",
|
|
8
|
+
);
|
package/v3.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var md5 = require('./lib/md5');
|
|
1
|
+
const util = require('util');
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
const v3 = require('./dist/v3.js');
|
|
4
|
+
|
|
5
|
+
module.exports = util.deprecate(
|
|
6
|
+
v3,
|
|
7
|
+
"Deep requiring like `const uuidv3 = require('uuid/v3');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v3x-of-this-module for more information.",
|
|
8
|
+
);
|
package/v4.js
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var bytesToUuid = require('./lib/bytesToUuid');
|
|
1
|
+
const util = require('util');
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
var i = buf && offset || 0;
|
|
3
|
+
const v4 = require('./dist/v4.js');
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
options = options || {};
|
|
12
|
-
|
|
13
|
-
var rnds = options.random || (options.rng || rng)();
|
|
14
|
-
|
|
15
|
-
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
16
|
-
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
17
|
-
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
18
|
-
|
|
19
|
-
// Copy bytes to buffer, if provided
|
|
20
|
-
if (buf) {
|
|
21
|
-
for (var ii = 0; ii < 16; ++ii) {
|
|
22
|
-
buf[i + ii] = rnds[ii];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return buf || bytesToUuid(rnds);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = v4;
|
|
5
|
+
module.exports = util.deprecate(
|
|
6
|
+
v4,
|
|
7
|
+
"Deep requiring like `const uuidv4 = require('uuid/v4');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v3x-of-this-module for more information.",
|
|
8
|
+
);
|
package/v5.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const util = require('util');
|
|
2
|
+
|
|
3
|
+
const v5 = require('./dist/v5.js');
|
|
4
|
+
|
|
5
|
+
module.exports = util.deprecate(
|
|
6
|
+
v5,
|
|
7
|
+
"Deep requiring like `const uuidv5 = require('uuid/v5');` is deprecated as of uuid@7.x. Please require the top-level module when using the Node.js CommonJS module or use ECMAScript Modules when bundling for the browser. See https://github.com/uuidjs/uuid/blob/master/README.md#upgrading-from-v5x-of-this-module for more information.",
|
|
8
|
+
);
|