Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular2-uuid

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-uuid - npm Package Compare versions

Comparing version 1.0.2 to 1.0.4

.npmignore

78

index.js

@@ -1,46 +0,38 @@

(function (factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports); if (v !== undefined) module.exports = v;
/*jshint bitwise: false*/
"use strict";
var UUID = (function () {
function UUID() {
// no-op
}
else if (typeof define === 'function' && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
/*jshint bitwise: false*/
"use strict";
var UUID = (function () {
function UUID() {
// no-op
UUID.UUID = function () {
if (typeof (window.crypto) !== "undefined" && typeof (window.crypto.getRandomValues) !== "undefined") {
// If we have a cryptographically secure PRNG, use that
// http://stackoverflow.com/questions/6906916/collisions-when-generating-uuids-in-javascript
var buf = new Uint16Array(8);
window.crypto.getRandomValues(buf);
var S4 = function (num) {
var ret = num.toString(16);
while (ret.length < 4) {
ret = "0" + ret;
}
return ret;
};
return (S4(buf[0]) + S4(buf[1]) + "-" + S4(buf[2]) + "-" + S4(buf[3]) + "-" + S4(buf[4]) + "-" + S4(buf[5]) + S4(buf[6]) + S4(buf[7]));
}
UUID.UUID = function () {
if (typeof (window.crypto) !== "undefined" && typeof (window.crypto.getRandomValues) !== "undefined") {
// If we have a cryptographically secure PRNG, use that
// http://stackoverflow.com/questions/6906916/collisions-when-generating-uuids-in-javascript
var buf = new Uint16Array(8);
window.crypto.getRandomValues(buf);
var S4 = function (num) {
var ret = num.toString(16);
while (ret.length < 4) {
ret = "0" + ret;
}
return ret;
};
return (S4(buf[0]) + S4(buf[1]) + "-" + S4(buf[2]) + "-" + S4(buf[3]) + "-" + S4(buf[4]) + "-" + S4(buf[5]) + S4(buf[6]) + S4(buf[7]));
else {
// Otherwise, just use Math.random
// https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
// https://stackoverflow.com/questions/11605068/why-does-jshint-argue-against-bitwise-operators-how-should-i-express-this-code
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
else {
// Otherwise, just use Math.random
// https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
// https://stackoverflow.com/questions/11605068/why-does-jshint-argue-against-bitwise-operators-how-should-i-express-this-code
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return s4() + s4() + "-" + s4() + "-" + s4() + "-" +
s4() + "-" + s4() + s4() + s4();
}
};
return UUID;
})();
exports.UUID = UUID;
});
return s4() + s4() + "-" + s4() + "-" + s4() + "-" +
s4() + "-" + s4() + s4() + s4();
}
};
return UUID;
})();
exports.UUID = UUID;
//# sourceMappingURL=index.js.map
{
"name": "angular2-uuid",
"version": "1.0.2",
"version": "1.0.4",
"description": "Angular 2 / TypeScript crypto-secure UUID generator",
"main": "index.ts",
"main": "index.js",
"typings": "./index.d.ts",
"scripts": {
"prepublish": "tsc",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -8,0 +10,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc