Socket
Socket
Sign inDemoInstall

bson

Package Overview
Dependencies
Maintainers
4
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bson - npm Package Compare versions

Comparing version 4.0.0-rc5 to 4.0.0-rc6

26

lib/parser/utils.js

@@ -13,15 +13,17 @@ 'use strict';

let randomBytes;
if (typeof window !== 'undefined') {
if (window.crypto && window.crypto.getRandomValues) {
randomBytes = size => window.crypto.getRandomValues(new Uint8Array(size));
} else {
randomBytes = size => {
const result = new Uint8Array(size);
for (let i = 0; i < size; ++i) result[i] = Math.floor(Math.random() * 256);
return result;
};
function insecureRandomBytes(size) {
const result = new Uint8Array(size);
for (let i = 0; i < size; ++i) result[i] = Math.floor(Math.random() * 256);
return result;
}
let randomBytes = insecureRandomBytes;
if (typeof window !== 'undefined' && window.crypto && window.crypto.getRandomValues) {
randomBytes = size => window.crypto.getRandomValues(new Uint8Array(size));
} else {
try {
randomBytes = require('crypto').randomBytes;
} catch (e) {
// keep the fallback
}
} else {
randomBytes = require('crypto').randomBytes;
}

@@ -28,0 +30,0 @@

@@ -14,3 +14,3 @@ {

],
"version": "4.0.0-rc5",
"version": "4.0.0-rc6",
"author": "Christian Amor Kvalheim <christkv@gmail.com>",

@@ -57,3 +57,3 @@ "license": "Apache-2.0",

"browser": {
"./index.js": "./dist/bson.browser.umd.js",
"./lib/bson.js": "./dist/bson.browser.umd.js",
"./dist/bson.esm.js": "./dist/bson.browser.esm.js"

@@ -60,0 +60,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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