Comparing version 4.0.0 to 4.0.2
@@ -26,5 +26,5 @@ { | ||
"**/.*", | ||
"doc", | ||
"docs", | ||
"test" | ||
] | ||
} |
/* | ||
Version: v4.0.0 | ||
Version: v4.0.2 | ||
Apache License 2.0: Copyright (c) 2010-2017 LiosK | ||
*/ | ||
var UUID; | ||
UUID=function(f){function a(){}a.generate=function(){var b=a._getRandomInt,c=a._hexAligner;return c(b(32),8)+"-"+c(b(16),4)+"-"+c(16384|b(12),4)+"-"+c(32768|b(14),4)+"-"+c(b(48),12)};a._getRandomInt=function(b){if(0>b||53<b)return NaN;var c=0|1073741824*Math.random();return 30<b?c+1073741824*(0|Math.random()*(1<<b-30)):c>>>30-b};a._hexAligner=function(b,c){for(var a=b.toString(16),d=c-a.length,e="0";0<d;d>>>=1,e+=e)d&1&&(a=e+a);return a};a.overwrittenUUID=f;"undefined"!==typeof module&&module&&module.exports&& | ||
UUID=function(f){function a(){}a.generate=function(){var b=a._getRandomInt,c=a._hexAligner;return c(b(32),8)+"-"+c(b(16),4)+"-"+c(16384|b(12),4)+"-"+c(32768|b(14),4)+"-"+c(b(48),12)};a._getRandomInt=function(b){if(0>b||53<b)return NaN;var c=0|1073741824*Math.random();return 30<b?c+1073741824*(0|Math.random()*(1<<b-30)):c>>>30-b};a._hexAligner=function(b,c){for(var a=b.toString(16),d=c-a.length,e="0";0<d;d>>>=1,e+=e)d&1&&(a=e+a);return a};a.overwrittenUUID=f;"object"===typeof module&&"object"===typeof module.exports&& | ||
(module.exports=a);return a}(UUID); |
{ | ||
"name": "uuidjs", | ||
"version": "4.0.0", | ||
"version": "4.0.2", | ||
"title": "UUID.js", | ||
@@ -9,3 +9,3 @@ "description": "RFC-compliant UUID Generator for JavaScript", | ||
"directories": { | ||
"doc": "doc", | ||
"doc": "docs", | ||
"test": "test" | ||
@@ -15,5 +15,5 @@ }, | ||
"scripts": { | ||
"test": "qunit test/test.nodejs.js", | ||
"test": "qunit test/nodejs.js", | ||
"test-ts": "tsc --strict --noEmit types/uuidjs/uuidjs-tests.ts", | ||
"jsdoc": "jsdoc -R README.md -d doc src/uuid.js" | ||
"jsdoc": "jsdoc -R README.md -d docs src/uuid.js" | ||
}, | ||
@@ -20,0 +20,0 @@ "repository": { |
@@ -140,3 +140,3 @@ # NAME | ||
* [npm Package](https://www.npmjs.com/package/uuidjs) | ||
* [API Documentation](https://liosk.github.io/UUID.js/doc/) | ||
* [Run test cases on your browser](https://liosk.github.io/UUID.js/test/test.uuid.js.html) | ||
* [API Documentation](https://liosk.github.io/UUID.js/docs/) | ||
* [Run test cases on your browser](https://liosk.github.io/UUID.js/test/browser.html) |
@@ -6,3 +6,3 @@ /** | ||
* @author LiosK | ||
* @version v4.0.0 | ||
* @version v4.0.2 | ||
* @license Apache License 2.0: Copyright (c) 2010-2017 LiosK | ||
@@ -78,3 +78,3 @@ */ | ||
// for nodejs | ||
if (typeof module !== "undefined" && module && module.exports) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
module.exports = UUID; | ||
@@ -87,2 +87,2 @@ } | ||
// vim: et ts=2 sw=2 fdm=marker fmr& | ||
// vim: fdm=marker fmr& |
@@ -6,3 +6,3 @@ /** | ||
* @author LiosK | ||
* @version v4.0.0 | ||
* @version v4.0.2 | ||
* @license Apache License 2.0: Copyright (c) 2010-2017 LiosK | ||
@@ -370,3 +370,3 @@ */ | ||
// for nodejs | ||
if (typeof module !== "undefined" && module && module.exports) { | ||
if (typeof module === "object" && typeof module.exports === "object") { | ||
module.exports = UUID; | ||
@@ -379,2 +379,2 @@ } | ||
// vim: et ts=2 sw=2 fdm=marker fmr& | ||
// vim: fdm=marker fmr& |
@@ -61,3 +61,3 @@ "use strict;" | ||
// binom dist 99.9% confidence interval | ||
// binom dist middle 99.9% range | ||
const margin = 3.290527 * Math.sqrt(0.5 * 0.5 / n) | ||
@@ -64,0 +64,0 @@ const ubound = n * (0.5 + margin), lbound = n * (0.5 - margin) |
@@ -1,7 +0,8 @@ | ||
QUnit.module("UUID.generate()"); | ||
QUnit.module("UUID.generate()", function() { | ||
"use strict"; | ||
UUIDTestCommon.testV4AsString(function() { | ||
return UUID.generate(); | ||
UUIDTestCommon.testV4AsString(function() { | ||
return UUID.generate(); | ||
}); | ||
}); | ||
// vim: et ts=2 sw=2 |
@@ -1,4 +0,2 @@ | ||
QUnit.module("UUID.genV1() as object"); | ||
(function(QUnit) { | ||
QUnit.module("UUID.genV1() as object", function() { | ||
"use strict"; | ||
@@ -17,7 +15,6 @@ | ||
})(QUnit); | ||
}); | ||
QUnit.module("UUID.genV1() as string"); | ||
(function(QUnit) { | ||
QUnit.module("UUID.genV1() as string", function() { | ||
"use strict"; | ||
@@ -64,7 +61,6 @@ | ||
})(QUnit); | ||
}); | ||
QUnit.module("UUID.genV1() and UUID.resetState()"); | ||
(function(QUnit) { | ||
QUnit.module("UUID.genV1() and UUID.resetState()", function() { | ||
"use strict"; | ||
@@ -79,3 +75,3 @@ | ||
QUnit.test("mean +/- four-sigma tests for random bits (possible to fail in a certain low probability)", function(assert) { | ||
QUnit.test("random bit neutrality tests (often fail by design)", function(assert) { | ||
assert.expect(64); | ||
@@ -85,11 +81,12 @@ var n = 4096, uuids = []; | ||
var counts = UUIDTestCommon.countEachBitsOne(uuids); | ||
var mean = n * 0.5, sd = Math.sqrt(n * 0.5 * 0.5); // binom dist | ||
var lbound = mean - 4 * sd, ubound = mean + 4 * sd; | ||
// binom dist middle 99.99% range | ||
var margin = 3.890592 * Math.sqrt(0.5 * 0.5 / n); | ||
var ubound = 0.5 + margin, lbound = 0.5 - margin; | ||
for (var i = 64; i < 128; i++) { | ||
var c = counts[i]; | ||
var c = counts[i] / n; | ||
switch (i) { | ||
case 64: | ||
case 87: | ||
assert.equal(c, n, "bit " + i + ": reserved bit '1'"); | ||
assert.equal(c, 1, "bit " + i + ": reserved bit '1'"); | ||
break; | ||
@@ -100,3 +97,3 @@ case 65: | ||
default: | ||
assert.ok(lbound < c && c < ubound, "bit " + i + ": random bit " + c + " (allowable range: " + lbound + "-" + ubound + ")"); | ||
assert.ok(lbound < c && c < ubound, "bit " + i + ": random bit " + c + " (cutoff range: " + lbound + "-" + ubound + ")"); | ||
break; | ||
@@ -107,4 +104,2 @@ } | ||
})(QUnit); | ||
// vim: et ts=2 sw=2 | ||
}); |
@@ -1,4 +0,2 @@ | ||
QUnit.module("UUID.genV4() as object"); | ||
(function(QUnit) { | ||
QUnit.module("UUID.genV4() as object", function() { | ||
"use strict"; | ||
@@ -17,10 +15,11 @@ | ||
})(QUnit); | ||
}); | ||
QUnit.module("UUID.genV4() as string"); | ||
QUnit.module("UUID.genV4() as string", function() { | ||
"use strict"; | ||
UUIDTestCommon.testV4AsString(function() { | ||
return UUID.genV4().hexString; | ||
UUIDTestCommon.testV4AsString(function() { | ||
return UUID.genV4().hexString; | ||
}); | ||
}); | ||
// vim: et ts=2 sw=2 |
@@ -1,4 +0,2 @@ | ||
QUnit.module("UUID.NIL"); | ||
(function(QUnit) { | ||
QUnit.module("UUID.NIL", function() { | ||
"use strict"; | ||
@@ -12,4 +10,2 @@ | ||
})(QUnit); | ||
// vim: et ts=2 sw=2 | ||
}); |
@@ -1,4 +0,2 @@ | ||
QUnit.module("UUID.parse()"); | ||
(function(QUnit) { | ||
QUnit.module("UUID.parse()", function() { | ||
"use strict"; | ||
@@ -48,4 +46,2 @@ | ||
})(QUnit); | ||
// vim: et ts=2 sw=2 | ||
}); |
@@ -1,9 +0,10 @@ | ||
QUnit.module("UUID.useMathRandom()"); | ||
QUnit.module("UUID.useMathRandom()", function() { | ||
"use strict"; | ||
UUID.useMathRandom(); | ||
UUID.useMathRandom(); | ||
UUIDTestCommon.testV4AsString(function() { | ||
return UUID.generate(); | ||
UUIDTestCommon.testV4AsString(function() { | ||
return UUID.generate(); | ||
}); | ||
}); | ||
// vim: et ts=2 sw=2 |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
13
1109117
1564