Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-06-27 01:19:44 +0300
committerRebecca Turner <me@re-becca.org>2017-06-27 02:17:54 +0300
commitc1e751d2c0da291a946cab0773d8d921e728626b (patch)
tree16836dcb70e63b151576c9ef361362b8b14c7782 /node_modules/uuid
parent87309b73fb6793e118889965091f9fa7c21a6d46 (diff)
uuid@3.1.0
Diffstat (limited to 'node_modules/uuid')
-rw-r--r--node_modules/uuid/.eslintrc.json46
-rw-r--r--node_modules/uuid/.npmignore8
-rw-r--r--node_modules/uuid/.travis.yml5
-rw-r--r--node_modules/uuid/README.md153
-rwxr-xr-xnode_modules/uuid/bin/uuid58
-rw-r--r--node_modules/uuid/lib/bytesToUuid.js4
-rw-r--r--node_modules/uuid/lib/rng-browser.js4
-rw-r--r--node_modules/uuid/lib/rng.js4
-rw-r--r--node_modules/uuid/lib/sha1-browser.js85
-rw-r--r--node_modules/uuid/lib/sha1.js21
-rw-r--r--node_modules/uuid/package.json35
-rw-r--r--node_modules/uuid/test/mocha.opts3
-rw-r--r--node_modules/uuid/test/test.js96
-rw-r--r--node_modules/uuid/v1.js3
-rw-r--r--node_modules/uuid/v5.js42
15 files changed, 382 insertions, 185 deletions
diff --git a/node_modules/uuid/.eslintrc.json b/node_modules/uuid/.eslintrc.json
new file mode 100644
index 000000000..638b0a56f
--- /dev/null
+++ b/node_modules/uuid/.eslintrc.json
@@ -0,0 +1,46 @@
+{
+ "root": true,
+ "env": {
+ "browser": true,
+ "commonjs": true,
+ "node": true,
+ "mocha": true
+ },
+ "extends": ["eslint:recommended"],
+ "installedESLint": true,
+ "rules": {
+ "array-bracket-spacing": ["warn", "never"],
+ "arrow-body-style": ["warn", "as-needed"],
+ "arrow-parens": ["warn", "as-needed"],
+ "arrow-spacing": "warn",
+ "brace-style": "warn",
+ "camelcase": "warn",
+ "comma-spacing": ["warn", {"after": true}],
+ "dot-notation": "warn",
+ "indent": ["warn", 2, {
+ "SwitchCase": 1,
+ "FunctionDeclaration": {"parameters": 1},
+ "MemberExpression": 1,
+ "CallExpression": {"arguments": 1}
+ }],
+ "key-spacing": ["warn", {"beforeColon": false, "afterColon": true, "mode": "minimum"}],
+ "keyword-spacing": "warn",
+ "no-console": "off",
+ "no-empty": "off",
+ "no-multi-spaces": "warn",
+ "no-redeclare": "off",
+ "no-restricted-globals": ["warn", "Promise"],
+ "no-trailing-spaces": "warn",
+ "no-undef": "error",
+ "no-unused-vars": ["warn", {"args": "none"}],
+ "padded-blocks": ["warn", "never"],
+ "object-curly-spacing": ["warn", "never"],
+ "quotes": ["warn", "single"],
+ "react/prop-types": "off",
+ "react/jsx-no-bind": "off",
+ "semi": ["warn", "always"],
+ "space-before-blocks": ["warn", "always"],
+ "space-before-function-paren": ["warn", "never"],
+ "space-in-parens": ["warn", "never"]
+ }
+}
diff --git a/node_modules/uuid/.npmignore b/node_modules/uuid/.npmignore
deleted file mode 100644
index 67b88724d..000000000
--- a/node_modules/uuid/.npmignore
+++ /dev/null
@@ -1,8 +0,0 @@
-node_modules
-.DS_Store
-
-# VIM temp files
-*.sw*
-
-# Mac desktop services store
-.DS_Store
diff --git a/node_modules/uuid/.travis.yml b/node_modules/uuid/.travis.yml
deleted file mode 100644
index 8a2c585ee..000000000
--- a/node_modules/uuid/.travis.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-language: node_js
-node_js:
- - "0.12"
- - "4"
- - "6"
diff --git a/node_modules/uuid/README.md b/node_modules/uuid/README.md
index 82a79eb33..5adaa8f94 100644
--- a/node_modules/uuid/README.md
+++ b/node_modules/uuid/README.md
@@ -4,10 +4,10 @@ Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.
Features:
-* Generate RFC4122 version 1 or version 4 UUIDs
-* Runs in node.js and browsers
-* Cryptographically strong random number generation on supporting platforms
-* Small footprint (Want something smaller? [Check this out](https://gist.github.com/982883)!)
+* Support for version 1, 4 and 5 UUIDs
+* Cross-platform
+* Uses cryptographically-strong random number APIs (when available)
+* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883))
## Quickstart - CommonJS (Recommended)
@@ -15,39 +15,81 @@ Features:
npm install uuid
```
+Then generate your uuid version of choice ...
+
+Version 1 (timestamp):
+
+```javascript
+const uuidv1 = require('uuid/v1');
+uuidv1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
+```
+
+Version 4 (random):
+
+```javascript
+const uuidv4 = require('uuid/v4');
+uuidv4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
+```
+
+Version 5 (namespace):
+
```javascript
-// Generate a v1 UUID (time-based)
-const uuidV1 = require('uuid/v1');
-uuidV1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
+const uuidv5 = require('uuid/v5');
+
+// ... using predefined DNS namespace (for domain names)
+uuidv5('hello.example.com', uuidv5.DNS)); // -> 'fdda765f-fc57-5604-a269-52a7df8164ec'
-// Generate a v4 UUID (random)
-const uuidV4 = require('uuid/v4');
-uuidV4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
+// ... using predefined URL namespace (for, well, URLs)
+uuidv5('http://example.com/hello', uuidv5.URL); // -> '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
+
+// ... using a custom namespace
+const MY_NAMESPACE = '<UUID string you previously generated elsewhere>';
+uuidv5('Hello, World!', MY_NAMESPACE); // -> '90123e1c-7512-523e-bb28-76fab9f2f73d'
```
-## Quickstart - Pre-packaged for browsers (Not recommended)
+## Quickstart - Browser-ready Versions
Browser-ready versions of this module are available via [wzrd.in](https://github.com/jfhbrook/wzrd.in).
+For version 1 uuids:
+
```html
-<script src="http://wzrd.in/standalone/uuid@latest"></script>
+<script src="http://wzrd.in/standalone/uuid%2Fv1@latest"></script>
+<script>
+uuidv1(); // -> v1 UUID
+</script>
+```
+For version 4 uuids:
+
+```html
+<script src="http://wzrd.in/standalone/uuid%2Fv4@latest"></script>
<script>
-uuid.v1(); // -> v1 UUID
-uuid.v4(); // -> v4 UUID
+uuidv4(); // -> v4 UUID
</script>
```
-(Note: Do not do this in production. Just don't. wzrd.in is a great service, but if you're deploying a "real" service you should be using a packaging tool like browserify or webpack. If you do go this route you would be well advised to link to a specific version instead of `uuid@latest` to avoid having your code break when we roll out breaking changes.)
+For version 5 uuids:
+```html
+<script src="http://wzrd.in/standalone/uuid%2Fv5@latest"></script>
+<script>
+uuidv5('http://example.com/hello', uuidv5.URL); // -> v5 UUID
+</script>
+```
## API
-### uuid(...)
+### Version 1
-Generate a V4 uuid. See uuid.v4 documentation below.
+```javascript
+const uuidv1 = require('uuid/v1');
-### uuid.v1([`options` [, `buffer` [, `offset`]]])
+// Allowed arguments
+uuidv1();
+uuidv1(options);
+uuidv1(options, buffer, offset);
+```
Generate and return a RFC4122 v1 (timestamp-based) UUID.
@@ -63,14 +105,12 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
Returns `buffer`, if specified, otherwise the string form of the UUID
-Notes:
-
-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.)
+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.)
Example: Generate string UUID with fully-specified options
```javascript
-uuid.v1({
+uuidv1({
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
clockseq: 0x1234,
msecs: new Date('2011-11-01').getTime(),
@@ -83,19 +123,26 @@ Example: In-place generation of two binary IDs
```javascript
// Generate two ids in an array
const arr = new Array(32); // -> []
-uuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
-uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
+uuidv1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
+uuidv1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15]
```
-### uuid.v4([`options` [, `buffer` [, `offset`]]])
+### Version 4
+
+```javascript
+const uuidv4 = require('uuid/v4')
+
+// Allowed arguments
+uuidv4();
+uuidv4(options);
+uuidv4(options, buffer, offset);
+```
Generate and return a RFC4122 v4 UUID.
* `options` - (Object) Optional uuid state to apply. Properties may include:
-
* `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values
- * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values.
-
+ * `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255)
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
@@ -121,12 +168,60 @@ uuid.v4(null, buffer, 0);
uuid.v4(null, buffer, 16);
```
-## Testing
+### Version 5
+```javascript
+const uuidv5 = require('uuid/v4');
+
+// Allowed arguments
+uuidv5(name, namespace);
+uuidv5(name, namespace, buffer);
+uuidv5(name, namespace, buffer, offset);
```
+
+Generate and return a RFC4122 v4 UUID.
+
+* `name` - (String | Array[]) "name" to create UUID with
+* `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
+* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
+* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
+
+Returns `buffer`, if specified, otherwise the string form of the UUID
+
+Example:
+
+```javascript
+// Generate a unique namespace (typically you would do this once, outside of
+// your project, then bake this value into your code)
+const uuidv4 = require('uuid/v4');
+const MY_NAMESPACE = uuidv4(); //
+
+// Generate a couple namespace uuids
+const uuidv5 = require('uuid/v5');
+uuidv5('hello', MY_NAMESPACE);
+uuidv5('world', MY_NAMESPACE);
+```
+
+## Testing
+
+```shell
npm test
```
+## Deprecated / Browser-ready API
+
+The API below is available for legacy purposes and is not expected to be available post-3.X
+
+```javascript
+const uuid = require('uuid');
+
+uuid.v1(...); // alias of uuid/v1
+uuid.v4(...); // alias of uuid/v4
+uuid(...); // alias of uuid/v4
+
+// uuid.v5() is not supported in this API
+```
+
## Legacy node-uuid package
The code for the legacy node-uuid package is available in the `node-uuid` branch.
diff --git a/node_modules/uuid/bin/uuid b/node_modules/uuid/bin/uuid
index f732e9918..2fd26d764 100755
--- a/node_modules/uuid/bin/uuid
+++ b/node_modules/uuid/bin/uuid
@@ -1,26 +1,50 @@
#!/usr/bin/env node
+var assert = require('assert');
-var path = require('path');
-var uuid = require(path.join(__dirname, '..'));
+function usage() {
+ console.log('Usage:');
+ console.log(' uuid');
+ console.log(' uuid v1');
+ console.log(' uuid v4');
+ console.log(' uuid v5 <name> <namespace uuid>');
+ console.log(' uuid --help');
+ console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
+}
-var arg = process.argv[2];
+var args = process.argv.slice(2);
-if ('--help' === arg) {
- console.log('\n USAGE: uuid [version] [options]\n\n');
- console.log(' options:\n');
- console.log(' --help Display this message and exit\n');
+if (args.indexOf('--help') >= 0) {
+ usage();
process.exit(0);
}
+var version = args.shift() || 'v4';
-if (null == arg) {
- console.log(uuid());
- process.exit(0);
-}
+switch (version) {
+ case 'v1':
+ var uuidV1 = require('../v1');
+ console.log(uuidV1());
+ break;
-if ('v1' !== arg && 'v4' !== arg) {
- console.error('Version must be RFC4122 version 1 or version 4, denoted as "v1" or "v4"');
- process.exit(1);
-}
+ case 'v4':
+ var uuidV4 = require('../v4');
+ console.log(uuidV4());
+ break;
+
+ case 'v5':
+ var uuidV5 = require('../v5');
-console.log(uuid[arg]());
-process.exit(0);
+ var name = args.shift();
+ var namespace = args.shift();
+ assert(name != null, 'v5 name not specified');
+ assert(namespace != null, 'v5 namespace not specified');
+
+ if (namespace == 'URL') namespace = uuidV5.URL;
+ if (namespace == 'DNS') namespace = uuidV5.DNS;
+
+ console.log(uuidV5(name, namespace));
+ break;
+
+ default:
+ usage();
+ process.exit(1);
+}
diff --git a/node_modules/uuid/lib/bytesToUuid.js b/node_modules/uuid/lib/bytesToUuid.js
index 9ee989cb9..2c9a22309 100644
--- a/node_modules/uuid/lib/bytesToUuid.js
+++ b/node_modules/uuid/lib/bytesToUuid.js
@@ -1,6 +1,6 @@
/**
* Convert array of 16 byte values to UUID string format of the form:
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
var byteToHex = [];
for (var i = 0; i < 256; ++i) {
@@ -10,7 +10,7 @@ for (var i = 0; i < 256; ++i) {
function bytesToUuid(buf, offset) {
var i = offset || 0;
var bth = byteToHex;
- return bth[buf[i++]] + bth[buf[i++]] +
+ return bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
diff --git a/node_modules/uuid/lib/rng-browser.js b/node_modules/uuid/lib/rng-browser.js
index 88b7dfb68..ac39b1289 100644
--- a/node_modules/uuid/lib/rng-browser.js
+++ b/node_modules/uuid/lib/rng-browser.js
@@ -7,7 +7,7 @@ var rng;
var crypto = global.crypto || global.msCrypto; // for IE 11
if (crypto && crypto.getRandomValues) {
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
- var rnds8 = new Uint8Array(16);
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
rng = function whatwgRNG() {
crypto.getRandomValues(rnds8);
return rnds8;
@@ -19,7 +19,7 @@ if (!rng) {
//
// If all else fails, use Math.random(). It's fast, but is of unspecified
// quality.
- var rnds = new Array(16);
+ var rnds = new Array(16);
rng = function() {
for (var i = 0, r; i < 16; i++) {
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
diff --git a/node_modules/uuid/lib/rng.js b/node_modules/uuid/lib/rng.js
index 5624d9123..4a0182fd6 100644
--- a/node_modules/uuid/lib/rng.js
+++ b/node_modules/uuid/lib/rng.js
@@ -1,10 +1,10 @@
// Unique ID creation requires a high quality random # generator. In node.js
-// this is prett straight-forward - we use the crypto API.
+// this is pretty straight-forward - we use the crypto API.
var rb = require('crypto').randomBytes;
function rng() {
return rb(16);
-};
+}
module.exports = rng;
diff --git a/node_modules/uuid/lib/sha1-browser.js b/node_modules/uuid/lib/sha1-browser.js
new file mode 100644
index 000000000..dbc318420
--- /dev/null
+++ b/node_modules/uuid/lib/sha1-browser.js
@@ -0,0 +1,85 @@
+// Adapted from Chris Veness' SHA1 code at
+// http://www.movable-type.co.uk/scripts/sha1.html
+'use strict';
+
+function f(s, x, y, z) {
+ switch (s) {
+ case 0: return (x & y) ^ (~x & z);
+ case 1: return x ^ y ^ z;
+ case 2: return (x & y) ^ (x & z) ^ (y & z);
+ case 3: return x ^ y ^ z;
+ }
+}
+
+function ROTL(x, n) {
+ return (x << n) | (x>>> (32 - n));
+}
+
+function sha1(bytes) {
+ var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
+ var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
+
+ if (typeof(bytes) == 'string') {
+ var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
+ bytes = new Array(msg.length);
+ for (var i = 0; i < msg.length; i++) bytes[i] = msg.charCodeAt(i);
+ }
+
+ bytes.push(0x80);
+
+ var l = bytes.length/4 + 2;
+ var N = Math.ceil(l/16);
+ var M = new Array(N);
+
+ for (var i=0; i<N; i++) {
+ M[i] = new Array(16);
+ for (var j=0; j<16; j++) {
+ M[i][j] =
+ bytes[i * 64 + j * 4] << 24 |
+ bytes[i * 64 + j * 4 + 1] << 16 |
+ bytes[i * 64 + j * 4 + 2] << 8 |
+ bytes[i * 64 + j * 4 + 3];
+ }
+ }
+
+ M[N - 1][14] = ((bytes.length - 1) * 8) /
+ Math.pow(2, 32); M[N - 1][14] = Math.floor(M[N - 1][14]);
+ M[N - 1][15] = ((bytes.length - 1) * 8) & 0xffffffff;
+
+ for (var i=0; i<N; i++) {
+ var W = new Array(80);
+
+ for (var t=0; t<16; t++) W[t] = M[i][t];
+ for (var t=16; t<80; t++) {
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
+ }
+
+ var a = H[0], b = H[1], c = H[2], d = H[3], e = H[4];
+
+ for (var t=0; t<80; t++) {
+ var s = Math.floor(t/20);
+ var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
+ e = d;
+ d = c;
+ c = ROTL(b, 30) >>> 0;
+ b = a;
+ a = T;
+ }
+
+ H[0] = (H[0] + a) >>> 0;
+ H[1] = (H[1] + b) >>> 0;
+ H[2] = (H[2] + c) >>> 0;
+ H[3] = (H[3] + d) >>> 0;
+ H[4] = (H[4] + e) >>> 0;
+ }
+
+ return [
+ H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff,
+ H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff,
+ H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff,
+ H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff,
+ H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff
+ ];
+}
+
+module.exports = sha1;
diff --git a/node_modules/uuid/lib/sha1.js b/node_modules/uuid/lib/sha1.js
new file mode 100644
index 000000000..e8771ce54
--- /dev/null
+++ b/node_modules/uuid/lib/sha1.js
@@ -0,0 +1,21 @@
+'use strict';
+
+var crypto = require('crypto');
+
+function sha1(bytes) {
+ // support modern Buffer API
+ if (typeof Buffer.from === 'function') {
+ if (Array.isArray(bytes)) bytes = Buffer.from(bytes);
+ else if (typeof bytes === 'string') bytes = Buffer.from(bytes, 'utf8');
+ }
+
+ // support pre-v4 Buffer API
+ else {
+ if (Array.isArray(bytes)) bytes = new Buffer(bytes);
+ else if (typeof bytes === 'string') bytes = new Buffer(bytes, 'utf8');
+ }
+
+ return crypto.createHash('sha1').update(bytes).digest();
+}
+
+module.exports = sha1;
diff --git a/node_modules/uuid/package.json b/node_modules/uuid/package.json
index c888a25a2..8aebdb2ed 100644
--- a/node_modules/uuid/package.json
+++ b/node_modules/uuid/package.json
@@ -1,34 +1,36 @@
{
- "_from": "uuid@~3.0.1",
- "_id": "uuid@3.0.1",
- "_integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=",
+ "_from": "uuid@3.1.0",
+ "_id": "uuid@3.1.0",
+ "_inBundle": false,
+ "_integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==",
"_location": "/uuid",
"_phantomChildren": {},
"_requested": {
- "type": "range",
+ "type": "version",
"registry": true,
- "raw": "uuid@~3.0.1",
+ "raw": "uuid@3.1.0",
"name": "uuid",
"escapedName": "uuid",
- "rawSpec": "~3.0.1",
+ "rawSpec": "3.1.0",
"saveSpec": null,
- "fetchSpec": "~3.0.1"
+ "fetchSpec": "3.1.0"
},
"_requiredBy": [
+ "#USER",
"/",
"/request",
"/tap/coveralls/request"
],
- "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz",
- "_shasum": "6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1",
- "_shrinkwrap": null,
- "_spec": "uuid@~3.0.1",
- "_where": "/Users/zkat/Documents/code/npm",
+ "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz",
+ "_shasum": "3dd3d3e790abc24d7b0d3a034ffababe28ebbc04",
+ "_spec": "uuid@3.1.0",
+ "_where": "/Users/rebecca/code/npm",
"bin": {
"uuid": "./bin/uuid"
},
"browser": {
- "./lib/rng.js": "./lib/rng-browser.js"
+ "./lib/rng.js": "./lib/rng-browser.js",
+ "./lib/sha1.js": "./lib/sha1-browser.js"
},
"bugs": {
"url": "https://github.com/kelektiv/node-uuid/issues"
@@ -56,9 +58,8 @@
"email": "shtylman@gmail.com"
}
],
- "dependencies": {},
"deprecated": false,
- "description": "RFC4122 (v1 and v4) generator",
+ "description": "RFC4122 (v1, v4, and v5) UUIDs",
"devDependencies": {
"mocha": "3.1.2"
},
@@ -70,8 +71,6 @@
],
"license": "MIT",
"name": "uuid",
- "optionalDependencies": {},
- "peerDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/kelektiv/node-uuid.git"
@@ -79,5 +78,5 @@
"scripts": {
"test": "mocha test/test.js"
},
- "version": "3.0.1"
+ "version": "3.1.0"
}
diff --git a/node_modules/uuid/test/mocha.opts b/node_modules/uuid/test/mocha.opts
deleted file mode 100644
index 5d6a3113b..000000000
--- a/node_modules/uuid/test/mocha.opts
+++ /dev/null
@@ -1,3 +0,0 @@
---ui qunit
---reporter spec
---check-leaks
diff --git a/node_modules/uuid/test/test.js b/node_modules/uuid/test/test.js
deleted file mode 100644
index ec33bec01..000000000
--- a/node_modules/uuid/test/test.js
+++ /dev/null
@@ -1,96 +0,0 @@
-var assert = require('assert');
-
-var uuid = require('../');
-
-// Verify ordering of v1 ids created with explicit times
-var TIME = 1321644961388; // 2011-11-18 11:36:01.388-08:00
-
-function compare(name, ids) {
- test(name, function() {
- // avoid .map for older browsers
- for (var i=0 ; i<ids.length ; ++i) {
- ids[i] = ids[i].split('-').reverse().join('-');
- }
- ids = ids.sort();
- var sorted = ([].concat(ids)).sort();
-
- assert(sorted.toString() == ids.toString(), name + ' have expected order');
- });
-}
-
-// Verify ordering of v1 ids created using default behavior
-compare('uuids with current time', [
- uuid.v1(),
- uuid.v1(),
- uuid.v1(),
- uuid.v1(),
- uuid.v1()
-]);
-
-// Verify ordering of v1 ids created with explicit times
-compare('uuids with time option', [
- uuid.v1({msecs: TIME - 10*3600*1000}),
- uuid.v1({msecs: TIME - 1}),
- uuid.v1({msecs: TIME}),
- uuid.v1({msecs: TIME + 1}),
- uuid.v1({msecs: TIME + 28*24*3600*1000})
-]);
-
-test('msec', function() {
- assert(
- uuid.v1({msecs: TIME}) != uuid.v1({msecs: TIME}),
- 'IDs created at same msec are different'
- );
-});
-
-test('exception thrown when > 10k ids created in 1ms', function() {
- // Verify throw if too many ids created
- var thrown = false;
- try {
- uuid.v1({msecs: TIME, nsecs: 10000});
- } catch (e) {
- thrown = true;
- }
- assert(thrown, 'Exception thrown when > 10K ids created in 1 ms');
-});
-
-test('clock regression by msec', function() {
- // Verify clock regression bumps clockseq
- var uidt = uuid.v1({msecs: TIME});
- var uidtb = uuid.v1({msecs: TIME - 1});
- assert(
- parseInt(uidtb.split('-')[3], 16) - parseInt(uidt.split('-')[3], 16) === 1,
- 'Clock regression by msec increments the clockseq'
- );
-});
-
-test('clock regression by nsec', function() {
- // Verify clock regression bumps clockseq
- var uidtn = uuid.v1({msecs: TIME, nsecs: 10});
- var uidtnb = uuid.v1({msecs: TIME, nsecs: 9});
- assert(
- parseInt(uidtnb.split('-')[3], 16) - parseInt(uidtn.split('-')[3], 16) === 1,
- 'Clock regression by nsec increments the clockseq'
- );
-});
-
-test('explicit options product expected id', function() {
- // Verify explicit options produce expected id
- var id = uuid.v1({
- msecs: 1321651533573,
- nsecs: 5432,
- clockseq: 0x385c,
- node: [ 0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10 ]
- });
- assert(id == 'd9428888-122b-11e1-b85c-61cd3cbb3210', 'Explicit options produce expected id');
-});
-
-test('ids spanning 1ms boundary are 100ns apart', function() {
- // Verify adjacent ids across a msec boundary are 1 time unit apart
- var u0 = uuid.v1({msecs: TIME, nsecs: 9999});
- var u1 = uuid.v1({msecs: TIME + 1, nsecs: 0});
-
- var before = u0.split('-')[0], after = u1.split('-')[0];
- var dt = parseInt(after, 16) - parseInt(before, 16);
- assert(dt === 1, 'Ids spanning 1ms boundary are 100ns apart');
-});
diff --git a/node_modules/uuid/v1.js b/node_modules/uuid/v1.js
index 315bd4cd6..613f67e2e 100644
--- a/node_modules/uuid/v1.js
+++ b/node_modules/uuid/v1.js
@@ -1,6 +1,3 @@
-// Unique ID creation requires a high quality random # generator. We feature
-// detect to determine the best RNG source, normalizing to a function that
-// returns 128-bits of randomness, since that's what's usually required
var rng = require('./lib/rng');
var bytesToUuid = require('./lib/bytesToUuid');
diff --git a/node_modules/uuid/v5.js b/node_modules/uuid/v5.js
new file mode 100644
index 000000000..39cc35e7c
--- /dev/null
+++ b/node_modules/uuid/v5.js
@@ -0,0 +1,42 @@
+var sha1 = require('./lib/sha1-browser');
+var bytesToUuid = require('./lib/bytesToUuid');
+
+function uuidToBytes(uuid) {
+ // Note: We assume we're being passed a valid uuid string
+ var bytes = [];
+ uuid.replace(/[a-fA-F0-9]{2}/g, function(hex) {
+ bytes.push(parseInt(hex, 16));
+ });
+
+ return bytes;
+}
+
+function stringToBytes(str) {
+ str = unescape(encodeURIComponent(str)); // UTF8 escape
+ var bytes = new Array(str.length);
+ for (var i = 0; i < str.length; i++) {
+ bytes[i] = str.charCodeAt(i);
+ }
+ return bytes;
+}
+
+function v5(name, namespace, buf, offset) {
+ if (typeof(name) == 'string') name = stringToBytes(name);
+ if (typeof(namespace) == 'string') namespace = uuidToBytes(namespace);
+
+ if (!Array.isArray(name)) throw TypeError('name must be an array of bytes');
+ if (!Array.isArray(namespace) || namespace.length != 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values');
+
+ // Per 4.3
+ var bytes = sha1(namespace.concat(name));
+ bytes[6] = (bytes[6] & 0x0f) | 0x50;
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
+
+ return buf || bytesToUuid(bytes);
+}
+
+// Pre-defined namespaces, per Appendix C
+v5.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
+v5.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
+
+module.exports = v5;