New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bsonview

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bsonview - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

25

index.js
const {
ObjectView, StringView, TypeViewMixin, BooleanView,
ObjectView, StringView, TypeViewMixin, BooleanView, ArrayView,
} = require('structurae');

@@ -92,3 +92,3 @@ const ObjectIdView = require('./lib/objectid-view');

let index = 0;
while (caret < bson.length - 1) {
while (caret < bson.byteLength - 1) {
const elementType = bson[caret];

@@ -113,10 +113,15 @@ if (!BSONTypes[elementType]) {

start = index * length;
hasValue = start < view.length && valueLength;
hasValue = start < view.byteLength && valueLength;
} else {
const fieldName = this.getFieldName(bson.subarray(nameStart, nameEnd), View);
hasValue = fieldName && valueLength;
const fieldOptions = View.layout[fieldName];
start = fieldOptions.start;
fieldLength = fieldOptions.length;
SubView = fieldOptions.View;
if (fieldName) {
const fieldOptions = View.layout[fieldName];
start = fieldOptions.start;
fieldLength = fieldOptions.length;
SubView = fieldOptions.View;
const hasTypeConflict = ((elementType === 0x03
&& !(SubView.prototype instanceof ObjectView))
|| (elementType === 0x04 && !(SubView.prototype instanceof ArrayView)));
hasValue = !!valueLength && !hasTypeConflict;
}
}

@@ -160,3 +165,3 @@ if (hasValue) {

const { encodedFields, fields } = View;
const nameLength = name.length;
const nameLength = name.byteLength;
outer: for (let i = 0; i < encodedFields.length; i++) {

@@ -170,3 +175,3 @@ const fieldName = encodedFields[i];

}
return false;
return undefined;
}

@@ -173,0 +178,0 @@

6

package.json
{
"name": "bsonview",
"version": "0.3.0",
"version": "0.4.0",
"description": "Schema-based BSON using structurae's ObjectView binary protocol.",

@@ -36,3 +36,3 @@ "main": "index.js",

"dependencies": {
"structurae": "^3.0.1"
"structurae": "^3.0.3"
},

@@ -45,3 +45,3 @@ "devDependencies": {

"eslint-plugin-import": "^2.20.2",
"jest": "^25.2.6",
"jest": "^25.2.7",
"json-schema-faker": "^0.5.0-rcv.24"

@@ -48,0 +48,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