Comparing version 1.1.0 to 1.1.1
32
index.js
@@ -1,6 +0,5 @@ | ||
'use strict'; | ||
"use strict"; | ||
var crypto = require('crypto') | ||
,uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/ | ||
; | ||
var crypto = require("crypto"), | ||
uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/; | ||
@@ -10,24 +9,27 @@ exports = module.exports = genUUID; | ||
function genUUID(callback) { | ||
if (typeof(callback) !== 'function') { | ||
if (typeof callback !== "function") { | ||
var rnd = crypto.randomBytes(16); | ||
rnd[6] = (rnd[6] & 0x0f) | 0x40; | ||
rnd[8] = (rnd[8] & 0x3f) | 0x80; | ||
rnd = rnd.toString('hex').match(/(.{8})(.{4})(.{4})(.{4})(.{12})/); | ||
rnd = rnd.toString("hex").match(/(.{8})(.{4})(.{4})(.{4})(.{12})/); | ||
rnd.shift(); | ||
return rnd.join('-'); | ||
return rnd.join("-"); | ||
} | ||
crypto.randomBytes(16, function(err, rnd) { | ||
rnd[6] = (rnd[6] & 0x0f) | 0x40; | ||
rnd[8] = (rnd[8] & 0x3f) | 0x80; | ||
rnd = rnd.toString('hex').match(/(.{8})(.{4})(.{4})(.{4})(.{12})/); | ||
rnd.shift(); | ||
return rnd.join('-'); | ||
if (err) return callback(err); | ||
try { | ||
rnd[6] = (rnd[6] & 0x0f) | 0x40; | ||
rnd[8] = (rnd[8] & 0x3f) | 0x80; | ||
rnd = rnd.toString("hex").match(/(.{8})(.{4})(.{4})(.{4})(.{12})/); | ||
rnd.shift(); | ||
return callback(null, rnd.join("-")); | ||
} catch (err2) { | ||
return callback(err2); | ||
} | ||
}); | ||
} | ||
function isUUID(uuid) { | ||
return uuidPattern.test(uuid); | ||
} | ||
} |
{ | ||
"name": "uuid4", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Node UUID v4 Generator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4010
80