Socket
Socket
Sign inDemoInstall

brorand

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

24

index.js

@@ -5,3 +5,3 @@ var r;

if (!r)
r = new Rand();
r = new Rand(null);

@@ -11,4 +11,6 @@ return r.generate(len);

function Rand() {
function Rand(randy) {
this.randy = randy;
}
module.exports.Rand = Rand;

@@ -41,9 +43,19 @@ Rand.prototype.generate = function generate(len) {

} else {
// Node.js
var crypto;
// Node.js or Web worker
try {
var crypto = require('cry' + 'pto');
} catch (e) {
// Emulate crypto API using randy
var crypto = {
randomBytes: function randomBytes(n) {
var res = new Uint8Array(n);
for (var i = 0; i < res.length; i++)
res[i] = this.randy.getRandBits(8);
return res;
}
};
}
Rand.prototype._rand = function _rand(n) {
if (!crypto)
crypto = require('cry' + 'pto');
return crypto.randomBytes(n);
};
}
{
"name": "brorand",
"version": "1.0.1",
"version": "1.0.2",
"description": "Random number generator for browsers and node.js",

@@ -27,3 +27,6 @@ "main": "index.js",

"mocha": "^2.0.1"
},
"optionalDependencies": {
"randy.js": "^1.5.1"
}
}
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