Galerie und tage
This commit is contained in:
2
node_modules/uuid/.npmignore
generated
vendored
Normal file
2
node_modules/uuid/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
5
node_modules/uuid/.travis.yml
generated
vendored
Normal file
5
node_modules/uuid/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
5
node_modules/uuid/AUTHORS
generated
vendored
5
node_modules/uuid/AUTHORS
generated
vendored
@@ -1,5 +0,0 @@
|
||||
Robert Kieffer <robert@broofa.com>
|
||||
Christoph Tavan <dev@tavan.de>
|
||||
AJ ONeal <coolaj86@gmail.com>
|
||||
Vincent Voyer <vincent@zeroload.net>
|
||||
Roman Shtylman <shtylman@gmail.com>
|
||||
119
node_modules/uuid/CHANGELOG.md
generated
vendored
119
node_modules/uuid/CHANGELOG.md
generated
vendored
@@ -1,119 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
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.
|
||||
|
||||
## [3.4.0](https://github.com/uuidjs/uuid/compare/v3.3.3...v3.4.0) (2020-01-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* rename repository to github:uuidjs/uuid ([#351](https://github.com/uuidjs/uuid/issues/351)) ([e2d7314](https://github.com/uuidjs/uuid/commit/e2d7314)), closes [#338](https://github.com/uuidjs/uuid/issues/338)
|
||||
|
||||
### [3.3.3](https://github.com/uuidjs/uuid/compare/v3.3.2...v3.3.3) (2019-08-19)
|
||||
|
||||
<a name="3.3.2"></a>
|
||||
## [3.3.2](https://github.com/uuidjs/uuid/compare/v3.3.1...v3.3.2) (2018-06-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* typo ([305d877](https://github.com/uuidjs/uuid/commit/305d877))
|
||||
|
||||
|
||||
|
||||
<a name="3.3.1"></a>
|
||||
## [3.3.1](https://github.com/uuidjs/uuid/compare/v3.3.0...v3.3.1) (2018-06-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix [#284](https://github.com/uuidjs/uuid/issues/284) by setting function name in try-catch ([f2a60f2](https://github.com/uuidjs/uuid/commit/f2a60f2))
|
||||
|
||||
|
||||
|
||||
<a name="3.3.0"></a>
|
||||
# [3.3.0](https://github.com/uuidjs/uuid/compare/v3.2.1...v3.3.0) (2018-06-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* assignment to readonly property to allow running in strict mode ([#270](https://github.com/uuidjs/uuid/issues/270)) ([d062fdc](https://github.com/uuidjs/uuid/commit/d062fdc))
|
||||
* fix [#229](https://github.com/uuidjs/uuid/issues/229) ([c9684d4](https://github.com/uuidjs/uuid/commit/c9684d4))
|
||||
* Get correct version of IE11 crypto ([#274](https://github.com/uuidjs/uuid/issues/274)) ([153d331](https://github.com/uuidjs/uuid/commit/153d331))
|
||||
* mem issue when generating uuid ([#267](https://github.com/uuidjs/uuid/issues/267)) ([c47702c](https://github.com/uuidjs/uuid/commit/c47702c))
|
||||
|
||||
### Features
|
||||
|
||||
* enforce Conventional Commit style commit messages ([#282](https://github.com/uuidjs/uuid/issues/282)) ([cc9a182](https://github.com/uuidjs/uuid/commit/cc9a182))
|
||||
|
||||
|
||||
<a name="3.2.1"></a>
|
||||
## [3.2.1](https://github.com/uuidjs/uuid/compare/v3.2.0...v3.2.1) (2018-01-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))
|
||||
|
||||
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
# [3.2.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.2.0) (2018-01-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove mistakenly added typescript dependency, rollback version (standard-version will auto-increment) ([09fa824](https://github.com/uuidjs/uuid/commit/09fa824))
|
||||
* use msCrypto if available. Fixes [#241](https://github.com/uuidjs/uuid/issues/241) ([#247](https://github.com/uuidjs/uuid/issues/247)) ([1fef18b](https://github.com/uuidjs/uuid/commit/1fef18b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Add v3 Support ([#217](https://github.com/uuidjs/uuid/issues/217)) ([d94f726](https://github.com/uuidjs/uuid/commit/d94f726))
|
||||
|
||||
|
||||
# [3.1.0](https://github.com/uuidjs/uuid/compare/v3.1.0...v3.0.1) (2017-06-17)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* (fix) Add .npmignore file to exclude test/ and other non-essential files from packing. (#183)
|
||||
* Fix typo (#178)
|
||||
* Simple typo fix (#165)
|
||||
|
||||
### Features
|
||||
* v5 support in CLI (#197)
|
||||
* V5 support (#188)
|
||||
|
||||
|
||||
# 3.0.1 (2016-11-28)
|
||||
|
||||
* split uuid versions into separate files
|
||||
|
||||
|
||||
# 3.0.0 (2016-11-17)
|
||||
|
||||
* remove .parse and .unparse
|
||||
|
||||
|
||||
# 2.0.0
|
||||
|
||||
* Removed uuid.BufferClass
|
||||
|
||||
|
||||
# 1.4.0
|
||||
|
||||
* Improved module context detection
|
||||
* Removed public RNG functions
|
||||
|
||||
|
||||
# 1.3.2
|
||||
|
||||
* Improve tests and handling of v1() options (Issue #24)
|
||||
* Expose RNG option to allow for perf testing with different generators
|
||||
|
||||
|
||||
# 1.3.0
|
||||
|
||||
* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
|
||||
* Support for node.js crypto API
|
||||
* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
|
||||
23
node_modules/uuid/LICENSE.md
generated
vendored
23
node_modules/uuid/LICENSE.md
generated
vendored
@@ -1,21 +1,2 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Copyright (c) 2010-2012 Robert Kieffer
|
||||
MIT License - http://opensource.org/licenses/mit-license.php
|
||||
|
||||
295
node_modules/uuid/README.md
generated
vendored
295
node_modules/uuid/README.md
generated
vendored
@@ -1,97 +1,44 @@
|
||||
<!--
|
||||
-- This file is auto-generated from README_js.md. Changes should be made there.
|
||||
-->
|
||||
# uuid [](http://travis-ci.org/defunctzombie/node-uuid) #
|
||||
|
||||
# uuid [](http://travis-ci.org/kelektiv/node-uuid) #
|
||||
[](https://ci.testling.com/defunctzombie/node-uuid)
|
||||
|
||||
Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS.
|
||||
|
||||
Features:
|
||||
|
||||
* Support for version 1, 3, 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))
|
||||
* Generate RFC4122 version 1 or version 4 UUIDs
|
||||
* Runs in node.js and all browsers.
|
||||
* Cryptographically strong random # generation on supporting platforms
|
||||
* 1185 bytes minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! )
|
||||
* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html)
|
||||
|
||||
[**Deprecation warning**: The use of `require('uuid')` is deprecated and will not be
|
||||
supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.]
|
||||
## Getting Started
|
||||
|
||||
## Quickstart - CommonJS (Recommended)
|
||||
Install it in your browser:
|
||||
|
||||
```shell
|
||||
```html
|
||||
<script src="uuid.js"></script>
|
||||
```
|
||||
|
||||
Or in node.js:
|
||||
|
||||
```
|
||||
npm install uuid
|
||||
```
|
||||
|
||||
Then generate your uuid version of choice ...
|
||||
|
||||
Version 1 (timestamp):
|
||||
|
||||
```javascript
|
||||
const uuidv1 = require('uuid/v1');
|
||||
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
|
||||
var uuid = require('uuid');
|
||||
|
||||
```
|
||||
|
||||
Version 3 (namespace):
|
||||
|
||||
```javascript
|
||||
const uuidv3 = require('uuid/v3');
|
||||
|
||||
// ... using predefined DNS namespace (for domain names)
|
||||
uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
|
||||
|
||||
// ... using predefined URL namespace (for, well, URLs)
|
||||
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
||||
|
||||
// ... using a custom namespace
|
||||
//
|
||||
// Note: Custom namespaces should be a UUID string specific to your application!
|
||||
// E.g. the one here was generated using this modules `uuid` CLI.
|
||||
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
||||
uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
|
||||
|
||||
```
|
||||
|
||||
Version 4 (random):
|
||||
|
||||
```javascript
|
||||
const uuidv4 = require('uuid/v4');
|
||||
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
||||
|
||||
```
|
||||
|
||||
Version 5 (namespace):
|
||||
|
||||
```javascript
|
||||
const uuidv5 = require('uuid/v5');
|
||||
|
||||
// ... using predefined DNS namespace (for domain names)
|
||||
uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec'
|
||||
|
||||
// ... using predefined URL namespace (for, well, URLs)
|
||||
uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
|
||||
|
||||
// ... using a custom namespace
|
||||
//
|
||||
// Note: Custom namespaces should be a UUID string specific to your application!
|
||||
// E.g. the one here was generated using this modules `uuid` CLI.
|
||||
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
||||
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
||||
// Generate a v1 (time-based) id
|
||||
uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
|
||||
|
||||
// Generate a v4 (random) id
|
||||
uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### Version 1
|
||||
|
||||
```javascript
|
||||
const uuidv1 = require('uuid/v1');
|
||||
|
||||
// Incantations
|
||||
uuidv1();
|
||||
uuidv1(options);
|
||||
uuidv1(options, buffer, offset);
|
||||
```
|
||||
### uuid.v1([`options` [, `buffer` [, `offset`]]])
|
||||
|
||||
Generate and return a RFC4122 v1 (timestamp-based) UUID.
|
||||
|
||||
@@ -99,7 +46,7 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
|
||||
|
||||
* `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
|
||||
* `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
|
||||
* `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used.
|
||||
* `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used.
|
||||
* `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.
|
||||
|
||||
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
||||
@@ -107,170 +54,152 @@ Generate and return a RFC4122 v1 (timestamp-based) UUID.
|
||||
|
||||
Returns `buffer`, if specified, otherwise the string form of the UUID
|
||||
|
||||
Note: The default [node id](https://tools.ietf.org/html/rfc4122#section-4.1.6) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
|
||||
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.)
|
||||
|
||||
Example: Generate string UUID with fully-specified options
|
||||
|
||||
```javascript
|
||||
const v1options = {
|
||||
uuid.v1({
|
||||
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'
|
||||
|
||||
}); // -> "710b962e-041c-11e1-9234-0123456789ab"
|
||||
```
|
||||
|
||||
Example: In-place generation of two binary IDs
|
||||
|
||||
```javascript
|
||||
// Generate two ids in an array
|
||||
const arr = new Array();
|
||||
uuidv1(null, arr, 0); // ⇨
|
||||
// [
|
||||
// 44, 94, 164, 192, 64, 103,
|
||||
// 17, 233, 146, 52, 155, 29,
|
||||
// 235, 77, 59, 125
|
||||
// ]
|
||||
uuidv1(null, arr, 16); // ⇨
|
||||
// [
|
||||
// 44, 94, 164, 192, 64, 103, 17, 233,
|
||||
// 146, 52, 155, 29, 235, 77, 59, 125,
|
||||
// 44, 94, 164, 193, 64, 103, 17, 233,
|
||||
// 146, 52, 155, 29, 235, 77, 59, 125
|
||||
// ]
|
||||
var 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]
|
||||
|
||||
// Optionally use uuid.unparse() to get stringify the ids
|
||||
uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115'
|
||||
uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115'
|
||||
```
|
||||
|
||||
### Version 3
|
||||
|
||||
```javascript
|
||||
const uuidv3 = require('uuid/v3');
|
||||
|
||||
// Incantations
|
||||
uuidv3(name, namespace);
|
||||
uuidv3(name, namespace, buffer);
|
||||
uuidv3(name, namespace, buffer, offset);
|
||||
```
|
||||
|
||||
Generate and return a RFC4122 v3 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
|
||||
uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424'
|
||||
|
||||
```
|
||||
|
||||
### Version 4
|
||||
|
||||
```javascript
|
||||
const uuidv4 = require('uuid/v4')
|
||||
|
||||
// Incantations
|
||||
uuidv4();
|
||||
uuidv4(options);
|
||||
uuidv4(options, buffer, offset);
|
||||
```
|
||||
### uuid.v4([`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 function that returns an Array[16] of byte values (0-255)
|
||||
* `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.
|
||||
|
||||
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
||||
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
||||
|
||||
Returns `buffer`, if specified, otherwise the string form of the UUID
|
||||
|
||||
Example: Generate string UUID with predefined `random` values
|
||||
Example: Generate string UUID with fully-specified options
|
||||
|
||||
```javascript
|
||||
const v4options = {
|
||||
uuid.v4({
|
||||
random: [
|
||||
0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea,
|
||||
0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36
|
||||
]
|
||||
};
|
||||
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
||||
|
||||
});
|
||||
// -> "109156be-c4fb-41ea-b1b4-efe1671c5836"
|
||||
```
|
||||
|
||||
Example: Generate two IDs in a single buffer
|
||||
|
||||
```javascript
|
||||
const buffer = new Array();
|
||||
uuidv4(null, buffer, 0); // ⇨
|
||||
// [
|
||||
// 155, 29, 235, 77, 59,
|
||||
// 125, 75, 173, 155, 221,
|
||||
// 43, 13, 123, 61, 203,
|
||||
// 109
|
||||
// ]
|
||||
uuidv4(null, buffer, 16); // ⇨
|
||||
// [
|
||||
// 155, 29, 235, 77, 59, 125, 75, 173,
|
||||
// 155, 221, 43, 13, 123, 61, 203, 109,
|
||||
// 27, 157, 107, 205, 187, 253, 75, 45,
|
||||
// 155, 93, 171, 141, 251, 189, 75, 237
|
||||
// ]
|
||||
|
||||
var buffer = new Array(32); // (or 'new Buffer' in node.js)
|
||||
uuid.v4(null, buffer, 0);
|
||||
uuid.v4(null, buffer, 16);
|
||||
```
|
||||
|
||||
### Version 5
|
||||
### uuid.parse(id[, buffer[, offset]])
|
||||
### uuid.unparse(buffer[, offset])
|
||||
|
||||
Parse and unparse UUIDs
|
||||
|
||||
* `id` - (String) UUID(-like) string
|
||||
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used
|
||||
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0
|
||||
|
||||
Example parsing and unparsing a UUID string
|
||||
|
||||
```javascript
|
||||
const uuidv5 = require('uuid/v5');
|
||||
|
||||
// Incantations
|
||||
uuidv5(name, namespace);
|
||||
uuidv5(name, namespace, buffer);
|
||||
uuidv5(name, namespace, buffer, offset);
|
||||
var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> <Buffer 79 7f f0 43 11 eb 11 e1 80 d6 51 09 98 75 5d 10>
|
||||
var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10'
|
||||
```
|
||||
|
||||
Generate and return a RFC4122 v5 UUID.
|
||||
### uuid.noConflict()
|
||||
|
||||
* `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
|
||||
(Browsers only) Set `uuid` property back to it's previous value.
|
||||
|
||||
Returns `buffer`, if specified, otherwise the string form of the UUID
|
||||
Returns the uuid object.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b'
|
||||
|
||||
var myUuid = uuid.noConflict();
|
||||
myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
|
||||
```
|
||||
|
||||
## Command Line
|
||||
## Deprecated APIs
|
||||
|
||||
UUIDs can be generated from the command line with the `uuid` command.
|
||||
Support for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version.
|
||||
|
||||
```shell
|
||||
$ uuid
|
||||
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
||||
### uuid([format [, buffer [, offset]]])
|
||||
|
||||
$ uuid v1
|
||||
02d37060-d446-11e7-a9fa-7bdae751ebe1
|
||||
```
|
||||
|
||||
Type `uuid --help` for usage details
|
||||
uuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary).
|
||||
|
||||
## Testing
|
||||
|
||||
```shell
|
||||
npm test
|
||||
In node.js
|
||||
|
||||
```
|
||||
> cd test
|
||||
> node test.js
|
||||
```
|
||||
|
||||
----
|
||||
Markdown generated from [README_js.md](README_js.md) by [](https://github.com/broofa/runmd)
|
||||
In Browser
|
||||
|
||||
```
|
||||
open test/test.html
|
||||
```
|
||||
|
||||
### Benchmarking
|
||||
|
||||
Requires node.js
|
||||
|
||||
```
|
||||
cd benchmark/
|
||||
npm install
|
||||
node benchmark.js
|
||||
```
|
||||
|
||||
For a more complete discussion of uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/uuid/wiki/Benchmark)
|
||||
|
||||
For browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance).
|
||||
|
||||
## Release notes
|
||||
|
||||
### 2.0.0
|
||||
|
||||
* Removed uuid.BufferClass
|
||||
|
||||
### 1.4.0
|
||||
|
||||
* Improved module context detection
|
||||
* Removed public RNG functions
|
||||
|
||||
### 1.3.2
|
||||
|
||||
* Improve tests and handling of v1() options (Issue #24)
|
||||
* Expose RNG option to allow for perf testing with different generators
|
||||
|
||||
### 1.3.0
|
||||
|
||||
* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)!
|
||||
* Support for node.js crypto API
|
||||
* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code
|
||||
|
||||
53
node_modules/uuid/benchmark/README.md
generated
vendored
Normal file
53
node_modules/uuid/benchmark/README.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# node-uuid Benchmarks
|
||||
|
||||
### Results
|
||||
|
||||
To see the results of our benchmarks visit https://github.com/broofa/node-uuid/wiki/Benchmark
|
||||
|
||||
### Run them yourself
|
||||
|
||||
node-uuid comes with some benchmarks to measure performance of generating UUIDs. These can be run using node.js. node-uuid is being benchmarked against some other uuid modules, that are available through npm namely `uuid` and `uuid-js`.
|
||||
|
||||
To prepare and run the benchmark issue;
|
||||
|
||||
```
|
||||
npm install uuid uuid-js
|
||||
node benchmark/benchmark.js
|
||||
```
|
||||
|
||||
You'll see an output like this one:
|
||||
|
||||
```
|
||||
# v4
|
||||
nodeuuid.v4(): 854700 uuids/second
|
||||
nodeuuid.v4('binary'): 788643 uuids/second
|
||||
nodeuuid.v4('binary', buffer): 1336898 uuids/second
|
||||
uuid(): 479386 uuids/second
|
||||
uuid('binary'): 582072 uuids/second
|
||||
uuidjs.create(4): 312304 uuids/second
|
||||
|
||||
# v1
|
||||
nodeuuid.v1(): 938086 uuids/second
|
||||
nodeuuid.v1('binary'): 683060 uuids/second
|
||||
nodeuuid.v1('binary', buffer): 1644736 uuids/second
|
||||
uuidjs.create(1): 190621 uuids/second
|
||||
```
|
||||
|
||||
* The `uuid()` entries are for Nikhil Marathe's [uuid module](https://bitbucket.org/nikhilm/uuidjs) which is a wrapper around the native libuuid library.
|
||||
* The `uuidjs()` entries are for Patrick Negri's [uuid-js module](https://github.com/pnegri/uuid-js) which is a pure javascript implementation based on [UUID.js](https://github.com/LiosK/UUID.js) by LiosK.
|
||||
|
||||
If you want to get more reliable results you can run the benchmark multiple times and write the output into a log file:
|
||||
|
||||
```
|
||||
for i in {0..9}; do node benchmark/benchmark.js >> benchmark/bench_0.4.12.log; done;
|
||||
```
|
||||
|
||||
If you're interested in how performance varies between different node versions, you can issue the above command multiple times.
|
||||
|
||||
You can then use the shell script `bench.sh` provided in this directory to calculate the averages over all benchmark runs and draw a nice plot:
|
||||
|
||||
```
|
||||
(cd benchmark/ && ./bench.sh)
|
||||
```
|
||||
|
||||
This assumes you have [gnuplot](http://www.gnuplot.info/) and [ImageMagick](http://www.imagemagick.org/) installed. You'll find a nice `bench.png` graph in the `benchmark/` directory then.
|
||||
174
node_modules/uuid/benchmark/bench.gnu
generated
vendored
Normal file
174
node_modules/uuid/benchmark/bench.gnu
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
#!/opt/local/bin/gnuplot -persist
|
||||
#
|
||||
#
|
||||
# G N U P L O T
|
||||
# Version 4.4 patchlevel 3
|
||||
# last modified March 2011
|
||||
# System: Darwin 10.8.0
|
||||
#
|
||||
# Copyright (C) 1986-1993, 1998, 2004, 2007-2010
|
||||
# Thomas Williams, Colin Kelley and many others
|
||||
#
|
||||
# gnuplot home: http://www.gnuplot.info
|
||||
# faq, bugs, etc: type "help seeking-assistance"
|
||||
# immediate help: type "help"
|
||||
# plot window: hit 'h'
|
||||
set terminal postscript eps noenhanced defaultplex \
|
||||
leveldefault color colortext \
|
||||
solid linewidth 1.2 butt noclip \
|
||||
palfuncparam 2000,0.003 \
|
||||
"Helvetica" 14
|
||||
set output 'bench.eps'
|
||||
unset clip points
|
||||
set clip one
|
||||
unset clip two
|
||||
set bar 1.000000 front
|
||||
set border 31 front linetype -1 linewidth 1.000
|
||||
set xdata
|
||||
set ydata
|
||||
set zdata
|
||||
set x2data
|
||||
set y2data
|
||||
set timefmt x "%d/%m/%y,%H:%M"
|
||||
set timefmt y "%d/%m/%y,%H:%M"
|
||||
set timefmt z "%d/%m/%y,%H:%M"
|
||||
set timefmt x2 "%d/%m/%y,%H:%M"
|
||||
set timefmt y2 "%d/%m/%y,%H:%M"
|
||||
set timefmt cb "%d/%m/%y,%H:%M"
|
||||
set boxwidth
|
||||
set style fill empty border
|
||||
set style rectangle back fc lt -3 fillstyle solid 1.00 border lt -1
|
||||
set style circle radius graph 0.02, first 0, 0
|
||||
set dummy x,y
|
||||
set format x "% g"
|
||||
set format y "% g"
|
||||
set format x2 "% g"
|
||||
set format y2 "% g"
|
||||
set format z "% g"
|
||||
set format cb "% g"
|
||||
set angles radians
|
||||
unset grid
|
||||
set key title ""
|
||||
set key outside left top horizontal Right noreverse enhanced autotitles columnhead nobox
|
||||
set key noinvert samplen 4 spacing 1 width 0 height 0
|
||||
set key maxcolumns 2 maxrows 0
|
||||
unset label
|
||||
unset arrow
|
||||
set style increment default
|
||||
unset style line
|
||||
set style line 1 linetype 1 linewidth 2.000 pointtype 1 pointsize default pointinterval 0
|
||||
unset style arrow
|
||||
set style histogram clustered gap 2 title offset character 0, 0, 0
|
||||
unset logscale
|
||||
set offsets graph 0.05, 0.15, 0, 0
|
||||
set pointsize 1.5
|
||||
set pointintervalbox 1
|
||||
set encoding default
|
||||
unset polar
|
||||
unset parametric
|
||||
unset decimalsign
|
||||
set view 60, 30, 1, 1
|
||||
set samples 100, 100
|
||||
set isosamples 10, 10
|
||||
set surface
|
||||
unset contour
|
||||
set clabel '%8.3g'
|
||||
set mapping cartesian
|
||||
set datafile separator whitespace
|
||||
unset hidden3d
|
||||
set cntrparam order 4
|
||||
set cntrparam linear
|
||||
set cntrparam levels auto 5
|
||||
set cntrparam points 5
|
||||
set size ratio 0 1,1
|
||||
set origin 0,0
|
||||
set style data points
|
||||
set style function lines
|
||||
set xzeroaxis linetype -2 linewidth 1.000
|
||||
set yzeroaxis linetype -2 linewidth 1.000
|
||||
set zzeroaxis linetype -2 linewidth 1.000
|
||||
set x2zeroaxis linetype -2 linewidth 1.000
|
||||
set y2zeroaxis linetype -2 linewidth 1.000
|
||||
set ticslevel 0.5
|
||||
set mxtics default
|
||||
set mytics default
|
||||
set mztics default
|
||||
set mx2tics default
|
||||
set my2tics default
|
||||
set mcbtics default
|
||||
set xtics border in scale 1,0.5 mirror norotate offset character 0, 0, 0
|
||||
set xtics norangelimit
|
||||
set xtics ()
|
||||
set ytics border in scale 1,0.5 mirror norotate offset character 0, 0, 0
|
||||
set ytics autofreq norangelimit
|
||||
set ztics border in scale 1,0.5 nomirror norotate offset character 0, 0, 0
|
||||
set ztics autofreq norangelimit
|
||||
set nox2tics
|
||||
set noy2tics
|
||||
set cbtics border in scale 1,0.5 mirror norotate offset character 0, 0, 0
|
||||
set cbtics autofreq norangelimit
|
||||
set title ""
|
||||
set title offset character 0, 0, 0 font "" norotate
|
||||
set timestamp bottom
|
||||
set timestamp ""
|
||||
set timestamp offset character 0, 0, 0 font "" norotate
|
||||
set rrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] )
|
||||
set autoscale rfixmin
|
||||
set autoscale rfixmax
|
||||
set trange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] )
|
||||
set autoscale tfixmin
|
||||
set autoscale tfixmax
|
||||
set urange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
|
||||
set autoscale ufixmin
|
||||
set autoscale ufixmax
|
||||
set vrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
|
||||
set autoscale vfixmin
|
||||
set autoscale vfixmax
|
||||
set xlabel ""
|
||||
set xlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate
|
||||
set x2label ""
|
||||
set x2label offset character 0, 0, 0 font "" textcolor lt -1 norotate
|
||||
set xrange [ * : * ] noreverse nowriteback # (currently [-0.150000:3.15000] )
|
||||
set autoscale xfixmin
|
||||
set autoscale xfixmax
|
||||
set x2range [ * : * ] noreverse nowriteback # (currently [0.00000:3.00000] )
|
||||
set autoscale x2fixmin
|
||||
set autoscale x2fixmax
|
||||
set ylabel ""
|
||||
set ylabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270
|
||||
set y2label ""
|
||||
set y2label offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270
|
||||
set yrange [ 0.00000 : 1.90000e+06 ] noreverse nowriteback # (currently [:] )
|
||||
set autoscale yfixmin
|
||||
set autoscale yfixmax
|
||||
set y2range [ * : * ] noreverse nowriteback # (currently [0.00000:1.90000e+06] )
|
||||
set autoscale y2fixmin
|
||||
set autoscale y2fixmax
|
||||
set zlabel ""
|
||||
set zlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate
|
||||
set zrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] )
|
||||
set autoscale zfixmin
|
||||
set autoscale zfixmax
|
||||
set cblabel ""
|
||||
set cblabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270
|
||||
set cbrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] )
|
||||
set autoscale cbfixmin
|
||||
set autoscale cbfixmax
|
||||
set zero 1e-08
|
||||
set lmargin -1
|
||||
set bmargin -1
|
||||
set rmargin -1
|
||||
set tmargin -1
|
||||
set pm3d explicit at s
|
||||
set pm3d scansautomatic
|
||||
set pm3d interpolate 1,1 flush begin noftriangles nohidden3d corners2color mean
|
||||
set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB
|
||||
set palette rgbformulae 7, 5, 15
|
||||
set colorbox default
|
||||
set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault
|
||||
set loadpath
|
||||
set fontpath
|
||||
set fit noerrorvariables
|
||||
GNUTERM = "aqua"
|
||||
plot 'bench_results.txt' using 2:xticlabel(1) w lp lw 2, '' using 3:xticlabel(1) w lp lw 2, '' using 4:xticlabel(1) w lp lw 2, '' using 5:xticlabel(1) w lp lw 2, '' using 6:xticlabel(1) w lp lw 2, '' using 7:xticlabel(1) w lp lw 2, '' using 8:xticlabel(1) w lp lw 2, '' using 9:xticlabel(1) w lp lw 2
|
||||
# EOF
|
||||
34
node_modules/uuid/benchmark/bench.sh
generated
vendored
Executable file
34
node_modules/uuid/benchmark/bench.sh
generated
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
# for a given node version run:
|
||||
# for i in {0..9}; do node benchmark.js >> bench_0.6.2.log; done;
|
||||
|
||||
PATTERNS=('nodeuuid.v1()' "nodeuuid.v1('binary'," 'nodeuuid.v4()' "nodeuuid.v4('binary'," "uuid()" "uuid('binary')" 'uuidjs.create(1)' 'uuidjs.create(4)' '140byte')
|
||||
FILES=(node_uuid_v1_string node_uuid_v1_buf node_uuid_v4_string node_uuid_v4_buf libuuid_v4_string libuuid_v4_binary uuidjs_v1_string uuidjs_v4_string 140byte_es)
|
||||
INDICES=(2 3 2 3 2 2 2 2 2)
|
||||
VERSIONS=$( ls bench_*.log | sed -e 's/^bench_\([0-9\.]*\)\.log/\1/' | tr "\\n" " " )
|
||||
TMPJOIN="tmp_join"
|
||||
OUTPUT="bench_results.txt"
|
||||
|
||||
for I in ${!FILES[*]}; do
|
||||
F=${FILES[$I]}
|
||||
P=${PATTERNS[$I]}
|
||||
INDEX=${INDICES[$I]}
|
||||
echo "version $F" > $F
|
||||
for V in $VERSIONS; do
|
||||
(VAL=$( grep "$P" bench_$V.log | LC_ALL=en_US awk '{ sum += $'$INDEX' } END { print sum/NR }' ); echo $V $VAL) >> $F
|
||||
done
|
||||
if [ $I == 0 ]; then
|
||||
cat $F > $TMPJOIN
|
||||
else
|
||||
join $TMPJOIN $F > $OUTPUT
|
||||
cp $OUTPUT $TMPJOIN
|
||||
fi
|
||||
rm $F
|
||||
done
|
||||
|
||||
rm $TMPJOIN
|
||||
|
||||
gnuplot bench.gnu
|
||||
convert -density 200 -resize 800x560 -flatten bench.eps bench.png
|
||||
rm bench.eps
|
||||
34
node_modules/uuid/benchmark/benchmark-native.c
generated
vendored
Normal file
34
node_modules/uuid/benchmark/benchmark-native.c
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Test performance of native C UUID generation
|
||||
|
||||
To Compile: cc -luuid benchmark-native.c -o benchmark-native
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
int main() {
|
||||
uuid_t myid;
|
||||
char buf[36+1];
|
||||
int i;
|
||||
struct timeval t;
|
||||
double start, finish;
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
start = t.tv_sec + t.tv_usec/1e6;
|
||||
|
||||
int n = 2e5;
|
||||
for (i = 0; i < n; i++) {
|
||||
uuid_generate(myid);
|
||||
uuid_unparse(myid, buf);
|
||||
}
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
finish = t.tv_sec + t.tv_usec/1e6;
|
||||
double dur = finish - start;
|
||||
|
||||
printf("%d uuids/sec", (int)(n/dur));
|
||||
return 0;
|
||||
}
|
||||
84
node_modules/uuid/benchmark/benchmark.js
generated
vendored
Normal file
84
node_modules/uuid/benchmark/benchmark.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
try {
|
||||
var nodeuuid = require('../uuid');
|
||||
} catch (e) {
|
||||
console.error('node-uuid require failed - skipping tests');
|
||||
}
|
||||
|
||||
try {
|
||||
var uuid = require('uuid');
|
||||
} catch (e) {
|
||||
console.error('uuid require failed - skipping tests');
|
||||
}
|
||||
|
||||
try {
|
||||
var uuidjs = require('uuid-js');
|
||||
} catch (e) {
|
||||
console.error('uuid-js require failed - skipping tests');
|
||||
}
|
||||
|
||||
var N = 5e5;
|
||||
|
||||
function rate(msg, t) {
|
||||
console.log(msg + ': ' +
|
||||
(N / (Date.now() - t) * 1e3 | 0) +
|
||||
' uuids/second');
|
||||
}
|
||||
|
||||
console.log('# v4');
|
||||
|
||||
// node-uuid - string form
|
||||
if (nodeuuid) {
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4();
|
||||
rate('nodeuuid.v4() - using node.js crypto RNG', t);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4({rng: nodeuuid.mathRNG});
|
||||
rate('nodeuuid.v4() - using Math.random() RNG', t);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary');
|
||||
rate('nodeuuid.v4(\'binary\')', t);
|
||||
|
||||
var buffer = new nodeuuid.BufferClass(16);
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary', buffer);
|
||||
rate('nodeuuid.v4(\'binary\', buffer)', t);
|
||||
}
|
||||
|
||||
// libuuid - string form
|
||||
if (uuid) {
|
||||
for (var i = 0, t = Date.now(); i < N; i++) uuid();
|
||||
rate('uuid()', t);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) uuid('binary');
|
||||
rate('uuid(\'binary\')', t);
|
||||
}
|
||||
|
||||
// uuid-js - string form
|
||||
if (uuidjs) {
|
||||
for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(4);
|
||||
rate('uuidjs.create(4)', t);
|
||||
}
|
||||
|
||||
// 140byte.es
|
||||
for (var i = 0, t = Date.now(); i < N; i++) 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(s,r){r=Math.random()*16|0;return (s=='x'?r:r&0x3|0x8).toString(16)});
|
||||
rate('140byte.es_v4', t);
|
||||
|
||||
console.log('');
|
||||
console.log('# v1');
|
||||
|
||||
// node-uuid - v1 string form
|
||||
if (nodeuuid) {
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1();
|
||||
rate('nodeuuid.v1()', t);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary');
|
||||
rate('nodeuuid.v1(\'binary\')', t);
|
||||
|
||||
var buffer = new nodeuuid.BufferClass(16);
|
||||
for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary', buffer);
|
||||
rate('nodeuuid.v1(\'binary\', buffer)', t);
|
||||
}
|
||||
|
||||
// uuid-js - v1 string form
|
||||
if (uuidjs) {
|
||||
for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(1);
|
||||
rate('uuidjs.create(1)', t);
|
||||
}
|
||||
9
node_modules/uuid/benchmark/package.json
generated
vendored
Normal file
9
node_modules/uuid/benchmark/package.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "benchmark-uuid",
|
||||
"private": true,
|
||||
"description": "Benchmarks for node-uuid",
|
||||
"dependencies": {
|
||||
"uuid": "1.4.1",
|
||||
"uuid-js": "0.7.4"
|
||||
}
|
||||
}
|
||||
65
node_modules/uuid/bin/uuid
generated
vendored
65
node_modules/uuid/bin/uuid
generated
vendored
@@ -1,65 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var assert = require('assert');
|
||||
|
||||
function usage() {
|
||||
console.log('Usage:');
|
||||
console.log(' uuid');
|
||||
console.log(' uuid v1');
|
||||
console.log(' uuid v3 <name> <namespace uuid>');
|
||||
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 args = process.argv.slice(2);
|
||||
|
||||
if (args.indexOf('--help') >= 0) {
|
||||
usage();
|
||||
process.exit(0);
|
||||
}
|
||||
var version = args.shift() || 'v4';
|
||||
|
||||
switch (version) {
|
||||
case 'v1':
|
||||
var uuidV1 = require('../v1');
|
||||
console.log(uuidV1());
|
||||
break;
|
||||
|
||||
case 'v3':
|
||||
var uuidV3 = require('../v3');
|
||||
|
||||
var name = args.shift();
|
||||
var namespace = args.shift();
|
||||
assert(name != null, 'v3 name not specified');
|
||||
assert(namespace != null, 'v3 namespace not specified');
|
||||
|
||||
if (namespace == 'URL') namespace = uuidV3.URL;
|
||||
if (namespace == 'DNS') namespace = uuidV3.DNS;
|
||||
|
||||
console.log(uuidV3(name, namespace));
|
||||
break;
|
||||
|
||||
case 'v4':
|
||||
var uuidV4 = require('../v4');
|
||||
console.log(uuidV4());
|
||||
break;
|
||||
|
||||
case 'v5':
|
||||
var uuidV5 = require('../v5');
|
||||
|
||||
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);
|
||||
}
|
||||
8
node_modules/uuid/index.js
generated
vendored
8
node_modules/uuid/index.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
var v1 = require('./v1');
|
||||
var v4 = require('./v4');
|
||||
|
||||
var uuid = v4;
|
||||
uuid.v1 = v1;
|
||||
uuid.v4 = v4;
|
||||
|
||||
module.exports = uuid;
|
||||
26
node_modules/uuid/lib/bytesToUuid.js
generated
vendored
26
node_modules/uuid/lib/bytesToUuid.js
generated
vendored
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* Convert array of 16 byte values to UUID string format of the form:
|
||||
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
||||
*/
|
||||
var byteToHex = [];
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
||||
}
|
||||
|
||||
function bytesToUuid(buf, offset) {
|
||||
var i = offset || 0;
|
||||
var bth = byteToHex;
|
||||
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
||||
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++]], '-',
|
||||
bth[buf[i++]], bth[buf[i++]], '-',
|
||||
bth[buf[i++]], bth[buf[i++]],
|
||||
bth[buf[i++]], bth[buf[i++]],
|
||||
bth[buf[i++]], bth[buf[i++]]
|
||||
]).join('');
|
||||
}
|
||||
|
||||
module.exports = bytesToUuid;
|
||||
216
node_modules/uuid/lib/md5-browser.js
generated
vendored
216
node_modules/uuid/lib/md5-browser.js
generated
vendored
@@ -1,216 +0,0 @@
|
||||
/*
|
||||
* Browser-compatible JavaScript MD5
|
||||
*
|
||||
* Modification of JavaScript MD5
|
||||
* https://github.com/blueimp/JavaScript-MD5
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* https://opensource.org/licenses/MIT
|
||||
*
|
||||
* Based on
|
||||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||||
* Digest Algorithm, as defined in RFC 1321.
|
||||
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
||||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||||
* Distributed under the BSD License
|
||||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function md5(bytes) {
|
||||
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);
|
||||
}
|
||||
|
||||
return md5ToHexEncodedArray(
|
||||
wordsToMd5(
|
||||
bytesToWords(bytes)
|
||||
, bytes.length * 8)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert an array of little-endian words to an array of bytes
|
||||
*/
|
||||
function md5ToHexEncodedArray(input) {
|
||||
var i;
|
||||
var x;
|
||||
var output = [];
|
||||
var length32 = input.length * 32;
|
||||
var hexTab = '0123456789abcdef';
|
||||
var hex;
|
||||
|
||||
for (i = 0; i < length32; i += 8) {
|
||||
x = (input[i >> 5] >>> (i % 32)) & 0xFF;
|
||||
|
||||
hex = parseInt(hexTab.charAt((x >>> 4) & 0x0F) + hexTab.charAt(x & 0x0F), 16);
|
||||
|
||||
output.push(hex);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
||||
*/
|
||||
function wordsToMd5(x, len) {
|
||||
/* append padding */
|
||||
x[len >> 5] |= 0x80 << (len % 32);
|
||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||||
|
||||
var i;
|
||||
var olda;
|
||||
var oldb;
|
||||
var oldc;
|
||||
var oldd;
|
||||
var a = 1732584193;
|
||||
var b = -271733879;
|
||||
var c = -1732584194;
|
||||
|
||||
var d = 271733878;
|
||||
|
||||
for (i = 0; i < x.length; i += 16) {
|
||||
olda = a;
|
||||
oldb = b;
|
||||
oldc = c;
|
||||
oldd = d;
|
||||
|
||||
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
||||
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||
|
||||
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
||||
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||
|
||||
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
||||
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||
|
||||
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
||||
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||
|
||||
a = safeAdd(a, olda);
|
||||
b = safeAdd(b, oldb);
|
||||
c = safeAdd(c, oldc);
|
||||
d = safeAdd(d, oldd);
|
||||
}
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an array bytes to an array of little-endian words
|
||||
* Characters >255 have their high-byte silently ignored.
|
||||
*/
|
||||
function bytesToWords(input) {
|
||||
var i;
|
||||
var output = [];
|
||||
output[(input.length >> 2) - 1] = undefined;
|
||||
for (i = 0; i < output.length; i += 1) {
|
||||
output[i] = 0;
|
||||
}
|
||||
var length8 = input.length * 8;
|
||||
for (i = 0; i < length8; i += 8) {
|
||||
output[i >> 5] |= (input[(i / 8)] & 0xFF) << (i % 32);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||||
* to work around bugs in some JS interpreters.
|
||||
*/
|
||||
function safeAdd(x, y) {
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
||||
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise rotate a 32-bit number to the left.
|
||||
*/
|
||||
function bitRotateLeft(num, cnt) {
|
||||
return (num << cnt) | (num >>> (32 - cnt));
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions implement the four basic operations the algorithm uses.
|
||||
*/
|
||||
function md5cmn(q, a, b, x, s, t) {
|
||||
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
||||
}
|
||||
function md5ff(a, b, c, d, x, s, t) {
|
||||
return md5cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
}
|
||||
function md5gg(a, b, c, d, x, s, t) {
|
||||
return md5cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
}
|
||||
function md5hh(a, b, c, d, x, s, t) {
|
||||
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
function md5ii(a, b, c, d, x, s, t) {
|
||||
return md5cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
module.exports = md5;
|
||||
25
node_modules/uuid/lib/md5.js
generated
vendored
25
node_modules/uuid/lib/md5.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var crypto = require('crypto');
|
||||
|
||||
function md5(bytes) {
|
||||
if (typeof Buffer.from === 'function') {
|
||||
// Modern Buffer API
|
||||
if (Array.isArray(bytes)) {
|
||||
bytes = Buffer.from(bytes);
|
||||
} else if (typeof bytes === 'string') {
|
||||
bytes = Buffer.from(bytes, 'utf8');
|
||||
}
|
||||
} else {
|
||||
// Pre-v4 Buffer API
|
||||
if (Array.isArray(bytes)) {
|
||||
bytes = new Buffer(bytes);
|
||||
} else if (typeof bytes === 'string') {
|
||||
bytes = new Buffer(bytes, 'utf8');
|
||||
}
|
||||
}
|
||||
|
||||
return crypto.createHash('md5').update(bytes).digest();
|
||||
}
|
||||
|
||||
module.exports = md5;
|
||||
34
node_modules/uuid/lib/rng-browser.js
generated
vendored
34
node_modules/uuid/lib/rng-browser.js
generated
vendored
@@ -1,34 +0,0 @@
|
||||
// Unique ID creation requires a high quality random # generator. In the
|
||||
// browser this is a little complicated due to unknown quality of Math.random()
|
||||
// and inconsistent support for the `crypto` API. We do the best we can via
|
||||
// feature-detection
|
||||
|
||||
// getRandomValues needs to be invoked in a context where "this" is a Crypto
|
||||
// implementation. Also, find the complete implementation of crypto on IE11.
|
||||
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
|
||||
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
|
||||
|
||||
if (getRandomValues) {
|
||||
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
|
||||
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
|
||||
|
||||
module.exports = function whatwgRNG() {
|
||||
getRandomValues(rnds8);
|
||||
return rnds8;
|
||||
};
|
||||
} else {
|
||||
// Math.random()-based (RNG)
|
||||
//
|
||||
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
||||
// quality.
|
||||
var rnds = new Array(16);
|
||||
|
||||
module.exports = function mathRNG() {
|
||||
for (var i = 0, r; i < 16; i++) {
|
||||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
||||
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
||||
}
|
||||
|
||||
return rnds;
|
||||
};
|
||||
}
|
||||
8
node_modules/uuid/lib/rng.js
generated
vendored
8
node_modules/uuid/lib/rng.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
// Unique ID creation requires a high quality random # generator. In node.js
|
||||
// this is pretty straight-forward - we use the crypto API.
|
||||
|
||||
var crypto = require('crypto');
|
||||
|
||||
module.exports = function nodeRNG() {
|
||||
return crypto.randomBytes(16);
|
||||
};
|
||||
89
node_modules/uuid/lib/sha1-browser.js
generated
vendored
89
node_modules/uuid/lib/sha1-browser.js
generated
vendored
@@ -1,89 +0,0 @@
|
||||
// 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];
|
||||
var b = H[1];
|
||||
var c = H[2];
|
||||
var d = H[3];
|
||||
var 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;
|
||||
25
node_modules/uuid/lib/sha1.js
generated
vendored
25
node_modules/uuid/lib/sha1.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var crypto = require('crypto');
|
||||
|
||||
function sha1(bytes) {
|
||||
if (typeof Buffer.from === 'function') {
|
||||
// Modern Buffer API
|
||||
if (Array.isArray(bytes)) {
|
||||
bytes = Buffer.from(bytes);
|
||||
} else if (typeof bytes === 'string') {
|
||||
bytes = Buffer.from(bytes, 'utf8');
|
||||
}
|
||||
} else {
|
||||
// Pre-v4 Buffer API
|
||||
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;
|
||||
57
node_modules/uuid/lib/v35.js
generated
vendored
57
node_modules/uuid/lib/v35.js
generated
vendored
@@ -1,57 +0,0 @@
|
||||
var bytesToUuid = require('./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;
|
||||
}
|
||||
|
||||
module.exports = function(name, version, hashfunc) {
|
||||
var generateUUID = function(value, namespace, buf, offset) {
|
||||
var off = buf && offset || 0;
|
||||
|
||||
if (typeof(value) == 'string') value = stringToBytes(value);
|
||||
if (typeof(namespace) == 'string') namespace = uuidToBytes(namespace);
|
||||
|
||||
if (!Array.isArray(value)) throw TypeError('value 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 = hashfunc(namespace.concat(value));
|
||||
bytes[6] = (bytes[6] & 0x0f) | version;
|
||||
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||
|
||||
if (buf) {
|
||||
for (var idx = 0; idx < 16; ++idx) {
|
||||
buf[off+idx] = bytes[idx];
|
||||
}
|
||||
}
|
||||
|
||||
return buf || bytesToUuid(bytes);
|
||||
};
|
||||
|
||||
// Function#name is not settable on some platforms (#270)
|
||||
try {
|
||||
generateUUID.name = name;
|
||||
} catch (err) {
|
||||
}
|
||||
|
||||
// Pre-defined namespaces, per Appendix C
|
||||
generateUUID.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
||||
generateUUID.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
||||
|
||||
return generateUUID;
|
||||
};
|
||||
62
node_modules/uuid/misc/compare.js
generated
vendored
Normal file
62
node_modules/uuid/misc/compare.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
var assert = require('assert'),
|
||||
nodeuuid = require('../'),
|
||||
uuidjs = require('uuid-js'),
|
||||
util = require('util'),
|
||||
exec = require('child_process').exec,
|
||||
os = require('os');
|
||||
|
||||
// On Mac Os X / macports there's only the ossp-uuid package that provides uuid
|
||||
// On Linux there's uuid-runtime which provides uuidgen
|
||||
var uuidCmd = os.type() === 'Darwin' ? 'uuid -1' : 'uuidgen -t';
|
||||
|
||||
function compare(ids) {
|
||||
console.log(ids);
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var id = ids[i].split('-');
|
||||
id = [id[2], id[1], id[0]].join('');
|
||||
ids[i] = id;
|
||||
}
|
||||
var sorted = ([].concat(ids)).sort();
|
||||
|
||||
if (sorted.toString() !== ids.toString()) {
|
||||
console.log('Warning: sorted !== ids');
|
||||
} else {
|
||||
console.log('everything in order!');
|
||||
}
|
||||
}
|
||||
|
||||
// Test time order of v1 uuids
|
||||
var ids = [];
|
||||
while (ids.length < 10e3) ids.push(nodeuuid.v1());
|
||||
|
||||
var max = 10;
|
||||
console.log('node-uuid:');
|
||||
ids = [];
|
||||
for (var i = 0; i < max; i++) ids.push(nodeuuid.v1());
|
||||
compare(ids);
|
||||
|
||||
console.log('');
|
||||
console.log('uuidjs:');
|
||||
ids = [];
|
||||
for (var i = 0; i < max; i++) ids.push(uuidjs.create(1).toString());
|
||||
compare(ids);
|
||||
|
||||
console.log('');
|
||||
console.log('libuuid:');
|
||||
ids = [];
|
||||
var count = 0;
|
||||
var last = function() {
|
||||
compare(ids);
|
||||
}
|
||||
var cb = function(err, stdout, stderr) {
|
||||
ids.push(stdout.substring(0, stdout.length-1));
|
||||
count++;
|
||||
if (count < max) {
|
||||
return next();
|
||||
}
|
||||
last();
|
||||
};
|
||||
var next = function() {
|
||||
exec(uuidCmd, cb);
|
||||
};
|
||||
next();
|
||||
102
node_modules/uuid/misc/perf.js
generated
vendored
Normal file
102
node_modules/uuid/misc/perf.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
var assert = require('assert');
|
||||
|
||||
var uuid = require('../');
|
||||
|
||||
var log = console.log;
|
||||
|
||||
var generators = {
|
||||
v1: uuid.v1,
|
||||
v4: uuid.v4
|
||||
};
|
||||
|
||||
var UUID_FORMAT = {
|
||||
v1: /[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i,
|
||||
v4: /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i
|
||||
};
|
||||
|
||||
var N = 1e4;
|
||||
|
||||
// Get %'age an actual value differs from the ideal value
|
||||
function divergence(actual, ideal) {
|
||||
return Math.round(100*100*(actual - ideal)/ideal)/100;
|
||||
}
|
||||
|
||||
function rate(msg, t) {
|
||||
log(msg + ': ' + (N / (Date.now() - t) * 1e3 | 0) + ' uuids\/second');
|
||||
}
|
||||
|
||||
for (var version in generators) {
|
||||
var counts = {}, max = 0;
|
||||
var generator = generators[version];
|
||||
var format = UUID_FORMAT[version];
|
||||
|
||||
log('\nSanity check ' + N + ' ' + version + ' uuids');
|
||||
for (var i = 0, ok = 0; i < N; i++) {
|
||||
id = generator();
|
||||
if (!format.test(id)) {
|
||||
throw Error(id + ' is not a valid UUID string');
|
||||
}
|
||||
|
||||
if (id != uuid.unparse(uuid.parse(id))) {
|
||||
assert(fail, id + ' is not a valid id');
|
||||
}
|
||||
|
||||
// Count digits for our randomness check
|
||||
if (version == 'v4') {
|
||||
var digits = id.replace(/-/g, '').split('');
|
||||
for (var j = digits.length-1; j >= 0; j--) {
|
||||
var c = digits[j];
|
||||
max = Math.max(max, counts[c] = (counts[c] || 0) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check randomness for v4 UUIDs
|
||||
if (version == 'v4') {
|
||||
// Limit that we get worried about randomness. (Purely empirical choice, this!)
|
||||
var limit = 2*100*Math.sqrt(1/N);
|
||||
|
||||
log('\nChecking v4 randomness. Distribution of Hex Digits (% deviation from ideal)');
|
||||
|
||||
for (var i = 0; i < 16; i++) {
|
||||
var c = i.toString(16);
|
||||
var bar = '', n = counts[c], p = Math.round(n/max*100|0);
|
||||
|
||||
// 1-3,5-8, and D-F: 1:16 odds over 30 digits
|
||||
var ideal = N*30/16;
|
||||
if (i == 4) {
|
||||
// 4: 1:1 odds on 1 digit, plus 1:16 odds on 30 digits
|
||||
ideal = N*(1 + 30/16);
|
||||
} else if (i >= 8 && i <= 11) {
|
||||
// 8-B: 1:4 odds on 1 digit, plus 1:16 odds on 30 digits
|
||||
ideal = N*(1/4 + 30/16);
|
||||
} else {
|
||||
// Otherwise: 1:16 odds on 30 digits
|
||||
ideal = N*30/16;
|
||||
}
|
||||
var d = divergence(n, ideal);
|
||||
|
||||
// Draw bar using UTF squares (just for grins)
|
||||
var s = n/max*50 | 0;
|
||||
while (s--) bar += '=';
|
||||
|
||||
assert(Math.abs(d) < limit, c + ' |' + bar + '| ' + counts[c] + ' (' + d + '% < ' + limit + '%)');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Perf tests
|
||||
for (var version in generators) {
|
||||
log('\nPerformance testing ' + version + ' UUIDs');
|
||||
var generator = generators[version];
|
||||
var buf = new uuid.BufferClass(16);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) generator();
|
||||
rate('uuid.' + version + '()', t);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) generator('binary');
|
||||
rate('uuid.' + version + '(\'binary\')', t);
|
||||
|
||||
for (var i = 0, t = Date.now(); i < N; i++) generator('binary', buf);
|
||||
rate('uuid.' + version + '(\'binary\', buffer)', t);
|
||||
}
|
||||
125
node_modules/uuid/package.json
generated
vendored
125
node_modules/uuid/package.json
generated
vendored
@@ -1,101 +1,46 @@
|
||||
{
|
||||
"_from": "uuid@^3.0.1",
|
||||
"_id": "uuid@3.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
||||
"_location": "/uuid",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "uuid@^3.0.1",
|
||||
"name": "uuid",
|
||||
"escapedName": "uuid",
|
||||
"rawSpec": "^3.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/request",
|
||||
"/tempfile"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||
"_shasum": "b23e4358afa8a202fe7a100af1f5f883f02007ee",
|
||||
"_spec": "uuid@^3.0.1",
|
||||
"_where": "/var/www/html/jason/WeihnachtenMelly/node_modules/tempfile",
|
||||
"bin": {
|
||||
"uuid": "bin/uuid"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/rng.js": "./lib/rng-browser.js",
|
||||
"./lib/sha1.js": "./lib/sha1-browser.js",
|
||||
"./lib/md5.js": "./lib/md5-browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/uuidjs/uuid/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
{
|
||||
"name": "Christoph Tavan",
|
||||
"email": "dev@tavan.de"
|
||||
},
|
||||
{
|
||||
"name": "AJ ONeal",
|
||||
"email": "coolaj86@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Vincent Voyer",
|
||||
"email": "vincent@zeroload.net"
|
||||
},
|
||||
{
|
||||
"name": "Roman Shtylman",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "RFC4122 (v1, v4, and v5) UUIDs",
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "~8.2.0",
|
||||
"@commitlint/config-conventional": "~8.2.0",
|
||||
"eslint": "~6.4.0",
|
||||
"husky": "~3.0.5",
|
||||
"mocha": "6.2.0",
|
||||
"runmd": "1.2.1",
|
||||
"standard-version": "7.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/uuidjs/uuid#readme",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
||||
}
|
||||
},
|
||||
"name": "uuid",
|
||||
"version": "2.0.3",
|
||||
"description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
|
||||
"keywords": [
|
||||
"uuid",
|
||||
"guid",
|
||||
"rfc4122"
|
||||
],
|
||||
"author": "Robert Kieffer <robert@broofa.com>",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Christoph Tavan <dev@tavan.de>",
|
||||
"github": "https://github.com/ctavan"
|
||||
},
|
||||
{
|
||||
"name": "Vincent Voyer <vincent@zeroload.net>",
|
||||
"github": "https://github.com/vvo"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "uuid",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/uuidjs/uuid.git"
|
||||
"main": "./uuid.js",
|
||||
"devDependencies": {
|
||||
"mocha": "1.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"md": "runmd --watch --output=README.md README_js.md",
|
||||
"prepare": "runmd --output=README.md README_js.md",
|
||||
"release": "standard-version",
|
||||
"test": "npm run lint && mocha test/test.js"
|
||||
"test": "mocha test/test.js"
|
||||
},
|
||||
"version": "3.4.0"
|
||||
"browser": {
|
||||
"./rng.js": "./rng-browser.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/defunctzombie/node-uuid.git"
|
||||
},
|
||||
"testling": {
|
||||
"browsers": [
|
||||
"ie6..latest",
|
||||
"firefox/3.6..latest",
|
||||
"chrome/22..latest",
|
||||
"safari/5.1..latest"
|
||||
],
|
||||
"harness": "mocha-tdd",
|
||||
"files": "test/*.js"
|
||||
}
|
||||
}
|
||||
|
||||
32
node_modules/uuid/rng-browser.js
generated
vendored
Normal file
32
node_modules/uuid/rng-browser.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
var rng;
|
||||
|
||||
var crypto = global.crypto || global.msCrypto; // for IE 11
|
||||
if (crypto && crypto.getRandomValues) {
|
||||
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
|
||||
// Moderately fast, high quality
|
||||
var _rnds8 = new Uint8Array(16);
|
||||
rng = function whatwgRNG() {
|
||||
crypto.getRandomValues(_rnds8);
|
||||
return _rnds8;
|
||||
};
|
||||
}
|
||||
|
||||
if (!rng) {
|
||||
// Math.random()-based (RNG)
|
||||
//
|
||||
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
||||
// quality.
|
||||
var _rnds = new Array(16);
|
||||
rng = function() {
|
||||
for (var i = 0, r; i < 16; i++) {
|
||||
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
||||
_rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
||||
}
|
||||
|
||||
return _rnds;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = rng;
|
||||
|
||||
4
node_modules/uuid/rng.js
generated
vendored
Normal file
4
node_modules/uuid/rng.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var rb = require('crypto').randomBytes;
|
||||
module.exports = function() {
|
||||
return rb(16);
|
||||
};
|
||||
1
node_modules/uuid/test/mocha.opts
generated
vendored
Normal file
1
node_modules/uuid/test/mocha.opts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
--ui qunit
|
||||
105
node_modules/uuid/test/test.js
generated
vendored
Normal file
105
node_modules/uuid/test/test.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
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');
|
||||
});
|
||||
|
||||
test('parse/unparse', function() {
|
||||
var id = '00112233445566778899aabbccddeeff';
|
||||
assert(uuid.unparse(uuid.parse(id.substr(0,10))) ==
|
||||
'00112233-4400-0000-0000-000000000000', 'Short parse');
|
||||
assert(uuid.unparse(uuid.parse('(this is the uuid -> ' + id + id)) ==
|
||||
'00112233-4455-6677-8899-aabbccddeeff', 'Dirty parse');
|
||||
});
|
||||
|
||||
183
node_modules/uuid/uuid.js
generated
vendored
Normal file
183
node_modules/uuid/uuid.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
// uuid.js
|
||||
//
|
||||
// Copyright (c) 2010-2012 Robert Kieffer
|
||||
// MIT License - http://opensource.org/licenses/mit-license.php
|
||||
|
||||
// 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('./rng');
|
||||
|
||||
// Maps for number <-> hex string conversion
|
||||
var _byteToHex = [];
|
||||
var _hexToByte = {};
|
||||
for (var i = 0; i < 256; i++) {
|
||||
_byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
||||
_hexToByte[_byteToHex[i]] = i;
|
||||
}
|
||||
|
||||
// **`parse()` - Parse a UUID into it's component bytes**
|
||||
function parse(s, buf, offset) {
|
||||
var i = (buf && offset) || 0, ii = 0;
|
||||
|
||||
buf = buf || [];
|
||||
s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) {
|
||||
if (ii < 16) { // Don't overflow!
|
||||
buf[i + ii++] = _hexToByte[oct];
|
||||
}
|
||||
});
|
||||
|
||||
// Zero out remaining bytes if string was short
|
||||
while (ii < 16) {
|
||||
buf[i + ii++] = 0;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
// **`unparse()` - Convert UUID byte array (ala parse()) into a string**
|
||||
function unparse(buf, offset) {
|
||||
var i = offset || 0, bth = _byteToHex;
|
||||
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++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]] +
|
||||
bth[buf[i++]] + bth[buf[i++]];
|
||||
}
|
||||
|
||||
// **`v1()` - Generate time-based UUID**
|
||||
//
|
||||
// Inspired by https://github.com/LiosK/UUID.js
|
||||
// and http://docs.python.org/library/uuid.html
|
||||
|
||||
// random #'s we need to init node and clockseq
|
||||
var _seedBytes = _rng();
|
||||
|
||||
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
||||
var _nodeId = [
|
||||
_seedBytes[0] | 0x01,
|
||||
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
|
||||
];
|
||||
|
||||
// Per 4.2.2, randomize (14 bit) clockseq
|
||||
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
|
||||
|
||||
// Previous uuid creation time
|
||||
var _lastMSecs = 0, _lastNSecs = 0;
|
||||
|
||||
// See https://github.com/broofa/node-uuid for API details
|
||||
function v1(options, buf, offset) {
|
||||
var i = buf && offset || 0;
|
||||
var b = buf || [];
|
||||
|
||||
options = options || {};
|
||||
|
||||
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
||||
|
||||
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
||||
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
||||
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
||||
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
||||
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
|
||||
// cycle to simulate higher resolution clock
|
||||
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
||||
|
||||
// Time since last uuid creation (in msecs)
|
||||
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
||||
|
||||
// Per 4.2.1.2, Bump clockseq on clock regression
|
||||
if (dt < 0 && options.clockseq === undefined) {
|
||||
clockseq = clockseq + 1 & 0x3fff;
|
||||
}
|
||||
|
||||
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
||||
// time interval
|
||||
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
||||
nsecs = 0;
|
||||
}
|
||||
|
||||
// Per 4.2.1.2 Throw error if too many uuids are requested
|
||||
if (nsecs >= 10000) {
|
||||
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
||||
}
|
||||
|
||||
_lastMSecs = msecs;
|
||||
_lastNSecs = nsecs;
|
||||
_clockseq = clockseq;
|
||||
|
||||
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
||||
msecs += 12219292800000;
|
||||
|
||||
// `time_low`
|
||||
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
||||
b[i++] = tl >>> 24 & 0xff;
|
||||
b[i++] = tl >>> 16 & 0xff;
|
||||
b[i++] = tl >>> 8 & 0xff;
|
||||
b[i++] = tl & 0xff;
|
||||
|
||||
// `time_mid`
|
||||
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
||||
b[i++] = tmh >>> 8 & 0xff;
|
||||
b[i++] = tmh & 0xff;
|
||||
|
||||
// `time_high_and_version`
|
||||
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
||||
b[i++] = tmh >>> 16 & 0xff;
|
||||
|
||||
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
||||
b[i++] = clockseq >>> 8 | 0x80;
|
||||
|
||||
// `clock_seq_low`
|
||||
b[i++] = clockseq & 0xff;
|
||||
|
||||
// `node`
|
||||
var node = options.node || _nodeId;
|
||||
for (var n = 0; n < 6; n++) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf ? buf : unparse(b);
|
||||
}
|
||||
|
||||
// **`v4()` - Generate random UUID**
|
||||
|
||||
// See https://github.com/broofa/node-uuid for API details
|
||||
function v4(options, buf, offset) {
|
||||
// Deprecated - 'format' argument, as supported in v1.2
|
||||
var i = buf && offset || 0;
|
||||
|
||||
if (typeof(options) == 'string') {
|
||||
buf = options == 'binary' ? new Array(16) : null;
|
||||
options = null;
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
var rnds = options.random || (options.rng || _rng)();
|
||||
|
||||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
||||
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
||||
|
||||
// Copy bytes to buffer, if provided
|
||||
if (buf) {
|
||||
for (var ii = 0; ii < 16; ii++) {
|
||||
buf[i + ii] = rnds[ii];
|
||||
}
|
||||
}
|
||||
|
||||
return buf || unparse(rnds);
|
||||
}
|
||||
|
||||
// Export public API
|
||||
var uuid = v4;
|
||||
uuid.v1 = v1;
|
||||
uuid.v4 = v4;
|
||||
uuid.parse = parse;
|
||||
uuid.unparse = unparse;
|
||||
|
||||
module.exports = uuid;
|
||||
109
node_modules/uuid/v1.js
generated
vendored
109
node_modules/uuid/v1.js
generated
vendored
@@ -1,109 +0,0 @@
|
||||
var rng = require('./lib/rng');
|
||||
var bytesToUuid = require('./lib/bytesToUuid');
|
||||
|
||||
// **`v1()` - Generate time-based UUID**
|
||||
//
|
||||
// Inspired by https://github.com/LiosK/UUID.js
|
||||
// and http://docs.python.org/library/uuid.html
|
||||
|
||||
var _nodeId;
|
||||
var _clockseq;
|
||||
|
||||
// Previous uuid creation time
|
||||
var _lastMSecs = 0;
|
||||
var _lastNSecs = 0;
|
||||
|
||||
// See https://github.com/uuidjs/uuid for API details
|
||||
function v1(options, buf, offset) {
|
||||
var i = buf && offset || 0;
|
||||
var b = buf || [];
|
||||
|
||||
options = options || {};
|
||||
var node = options.node || _nodeId;
|
||||
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
||||
|
||||
// node and clockseq need to be initialized to random values if they're not
|
||||
// specified. We do this lazily to minimize issues related to insufficient
|
||||
// system entropy. See #189
|
||||
if (node == null || clockseq == null) {
|
||||
var seedBytes = rng();
|
||||
if (node == null) {
|
||||
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
||||
node = _nodeId = [
|
||||
seedBytes[0] | 0x01,
|
||||
seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
|
||||
];
|
||||
}
|
||||
if (clockseq == null) {
|
||||
// Per 4.2.2, randomize (14 bit) clockseq
|
||||
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
||||
}
|
||||
}
|
||||
|
||||
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
||||
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
||||
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
||||
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
||||
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
|
||||
// cycle to simulate higher resolution clock
|
||||
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
||||
|
||||
// Time since last uuid creation (in msecs)
|
||||
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
||||
|
||||
// Per 4.2.1.2, Bump clockseq on clock regression
|
||||
if (dt < 0 && options.clockseq === undefined) {
|
||||
clockseq = clockseq + 1 & 0x3fff;
|
||||
}
|
||||
|
||||
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
||||
// time interval
|
||||
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
||||
nsecs = 0;
|
||||
}
|
||||
|
||||
// Per 4.2.1.2 Throw error if too many uuids are requested
|
||||
if (nsecs >= 10000) {
|
||||
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
||||
}
|
||||
|
||||
_lastMSecs = msecs;
|
||||
_lastNSecs = nsecs;
|
||||
_clockseq = clockseq;
|
||||
|
||||
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
||||
msecs += 12219292800000;
|
||||
|
||||
// `time_low`
|
||||
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
||||
b[i++] = tl >>> 24 & 0xff;
|
||||
b[i++] = tl >>> 16 & 0xff;
|
||||
b[i++] = tl >>> 8 & 0xff;
|
||||
b[i++] = tl & 0xff;
|
||||
|
||||
// `time_mid`
|
||||
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
||||
b[i++] = tmh >>> 8 & 0xff;
|
||||
b[i++] = tmh & 0xff;
|
||||
|
||||
// `time_high_and_version`
|
||||
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
||||
b[i++] = tmh >>> 16 & 0xff;
|
||||
|
||||
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
||||
b[i++] = clockseq >>> 8 | 0x80;
|
||||
|
||||
// `clock_seq_low`
|
||||
b[i++] = clockseq & 0xff;
|
||||
|
||||
// `node`
|
||||
for (var n = 0; n < 6; ++n) {
|
||||
b[i + n] = node[n];
|
||||
}
|
||||
|
||||
return buf ? buf : bytesToUuid(b);
|
||||
}
|
||||
|
||||
module.exports = v1;
|
||||
4
node_modules/uuid/v3.js
generated
vendored
4
node_modules/uuid/v3.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
var v35 = require('./lib/v35.js');
|
||||
var md5 = require('./lib/md5');
|
||||
|
||||
module.exports = v35('v3', 0x30, md5);
|
||||
29
node_modules/uuid/v4.js
generated
vendored
29
node_modules/uuid/v4.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
var rng = require('./lib/rng');
|
||||
var bytesToUuid = require('./lib/bytesToUuid');
|
||||
|
||||
function v4(options, buf, offset) {
|
||||
var i = buf && offset || 0;
|
||||
|
||||
if (typeof(options) == 'string') {
|
||||
buf = options === 'binary' ? new Array(16) : null;
|
||||
options = null;
|
||||
}
|
||||
options = options || {};
|
||||
|
||||
var rnds = options.random || (options.rng || rng)();
|
||||
|
||||
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
||||
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
||||
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
||||
|
||||
// Copy bytes to buffer, if provided
|
||||
if (buf) {
|
||||
for (var ii = 0; ii < 16; ++ii) {
|
||||
buf[i + ii] = rnds[ii];
|
||||
}
|
||||
}
|
||||
|
||||
return buf || bytesToUuid(rnds);
|
||||
}
|
||||
|
||||
module.exports = v4;
|
||||
3
node_modules/uuid/v5.js
generated
vendored
3
node_modules/uuid/v5.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
var v35 = require('./lib/v35.js');
|
||||
var sha1 = require('./lib/sha1');
|
||||
module.exports = v35('v5', 0x50, sha1);
|
||||
Reference in New Issue
Block a user