Socket
Socket
Sign inDemoInstall

generate-uid

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.5 to 0.1.6

23

index.js

@@ -12,7 +12,7 @@ var generateuid=(function () {

if (isNode) {
return nodeRandom(count)
return nodeRandom(count);
} else {
var crypto = window.crypto || window.msCrypto
if (!crypto) throw new Error("Your browser does not support window.crypto.")
return browserRandom(count)
var crypto = window.crypto || window.msCrypto;
if (!crypto) throw new Error("Your browser does not support window.crypto.");
return browserRandom(count);
}

@@ -23,10 +23,10 @@ }

var buf = crypto.randomBytes(count);
return [].slice.call(buf)
return [].slice.call(buf);
}
function browserRandom(count) {
var nativeArr = new Uint8Array(count)
var crypto = window.crypto || window.msCrypto
crypto.getRandomValues(nativeArr)
return [].slice.call(nativeArr)
var nativeArr = new Uint8Array(count);
var crypto = window.crypto || window.msCrypto;
crypto.getRandomValues(nativeArr);
return [].slice.call(nativeArr);
}

@@ -93,3 +93,6 @@

function _uid(cryptoBytes=false) {
function _uid(cryptoBytes) {
if(typeof cryptoBytes=="undefined"){
cryptoBytes=false;
}
var now = Date.now();

@@ -96,0 +99,0 @@ var timestamp = now;//(now).toString(16);

{
"name": "generate-uid",
"version": "0.1.5",
"version": "0.1.6",
"description": "generate unique id",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc