uuid-with-v6
Advanced tools
Comparing version 1.0.5 to 1.1.0
const crypto = require('crypto'); | ||
const uuid = require('uuid'); | ||
const v1 = require('uuid/v1'); | ||
const v4 = require('uuid/v4'); | ||
const v5 = require('uuid/v5'); | ||
@@ -10,3 +12,3 @@ function create(opts) { | ||
function generateId() { | ||
const raw = uuid.v1(); | ||
const raw = v1(); | ||
@@ -28,2 +30,2 @@ const prefix = `${raw.substring(15, 18)}${raw.substring(9, 13)}${raw.substring(0, 5)}6${raw.substring(5, 8)}`; | ||
module.exports = Object.assign(uuid, { v6: create(), v6setup: create }); | ||
module.exports = { v1, v4, v5, v6: create(), v6setup: create }; |
{ | ||
"name": "uuid-with-v6", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "UUID Version 6", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"uuid": "3.0.1" | ||
"uuid": "3.1.0" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
@@ -26,3 +26,3 @@ uuid-with-v6 [](https://travis-ci.org/kurttheviking/uuid-with-v6-js) [](https://coveralls.io/github/kurttheviking/uuid-with-v6-js?branch=master) | ||
console.log(uuid.v6()) | ||
console.log(uuid.v6()); | ||
``` | ||
@@ -37,8 +37,12 @@ | ||
See the [`uuid` documentation](https://github.com/kelektiv/node-uuid#uuidv1options--buffer--offset). | ||
See the [`uuid` documentation](https://github.com/kelektiv/node-uuid/tree/72fbabbf00192817bdce7073e323361f5e7bdd67#version-3). | ||
### `uuid#v4` | ||
See the [`uuid` documentation](https://github.com/kelektiv/node-uuid#uuidv4options--buffer--offset). | ||
See the [`uuid` documentation](https://github.com/kelektiv/node-uuid/tree/72fbabbf00192817bdce7073e323361f5e7bdd67#version-4). | ||
### `uuid#v5` | ||
See the [`uuid` documentation](https://github.com/kelektiv/node-uuid/tree/72fbabbf00192817bdce7073e323361f5e7bdd67#version-5). | ||
### `uuid#v6` | ||
@@ -115,4 +119,4 @@ | ||
- The "high" portion of the timestamp is at the beginning, followed by the "medium" and "low" | ||
- `xxxxxxxx-xxxx-1xxx-xxxx-xxxxxxxxxxxx` → `xxxxxxxx-xxxx-6xxx-xxxx-xxxxxxxxxxxx` | ||
- Each identifier ends with cryptographically-strong randomness | ||
- The 15th character (version number) is a `6`, rather than a `1` | ||
- Each UUIDv6 identifier ends with cryptographically-strong randomness | ||
@@ -153,20 +157,20 @@ ``` | ||
uuid | ||
generate UUIDv1 ................................ 1,862,245 op/s | ||
generate UUIDv4 ................................ 436,730 op/s | ||
generate UUIDv1 ................................ 1,903,395 op/s | ||
generate UUIDv4 ................................ 415,695 op/s | ||
uuid-with-v6 | ||
generate UUIDv6 ................................ 280,226 op/s | ||
generate UUIDv6 without randomness ............. 813,677 op/s | ||
generate UUIDv6 ................................ 273,566 op/s | ||
generate UUIDv6 without randomness ............. 819,767 op/s | ||
uniqid | ||
generate UNIQID ................................ 2,619,573 op/s | ||
generate UNIQID ................................ 2,608,630 op/s | ||
scuid | ||
generate SCUID ................................. 920,816 op/s | ||
generate SCUID ................................. 927,743 op/s | ||
uild | ||
generate ULID .................................. 32,165 op/s | ||
ulid | ||
generate ULID .................................. 29,619 op/s | ||
``` | ||
The above statistics represent performance on a 2nd-generation Lenovo Carbon X1 (i5 2.90GHz, 8GB DDR3) running Ubuntu 16 LTS (16.04.2). [Your mileage may vary.](https://foldoc.org/ymmv) If interested, read more about [uniqid](https://www.npmjs.com/package/uniqid), [ulid](https://www.npmjs.com/package/ulid), and [scuid](https://www.npmjs.com/package/scuid) (a faster version of [cuid](https://www.npmjs.com/package/cuid)). | ||
The above statistics represent performance on a 2nd-generation Lenovo Carbon X1 (i5 2.90GHz, 8GB DDR3) running Ubuntu 16 LTS (16.04.2). [Your mileage may vary.](https://foldoc.org/ymmv) Read more about [uniqid](https://www.npmjs.com/package/uniqid), [scuid](https://www.npmjs.com/package/scuid) (a faster version of [cuid](https://www.npmjs.com/package/cuid)), and [ulid](https://www.npmjs.com/package/ulid). | ||
@@ -173,0 +177,0 @@ ### Collision risk |
11308
20
234
+ Addeduuid@3.1.0(transitive)
- Removeduuid@3.0.1(transitive)
Updateduuid@3.1.0