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

protobuf.js

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protobuf.js - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

36

index.js

@@ -210,14 +210,33 @@ var fs = require('fs'),

if (schema.hasOwnProperty(key) && typeof params[key] !== 'undefined') {
bytes.push((schema[key].field << 3) + schema[key].type);
if (schema[key].type === 2) {
if (Buffer.isBuffer(params[key])) params[key] = bufferToArray(params[key]);
if (!Array.isArray(params[key]) && typeof params[key] === 'object') {
params[key] = self.encode(schema[key].raw_type, params[key]);
params[key] = bufferToArray(params[key]);
}
if (Array.isArray(params[key])) {
if (Buffer.isBuffer(params[key])) {
bytes.push((schema[key].field << 3) + schema[key].type);
var encoded = encode(params[key].length);
bytes = bytes.concat(bufferToArray(encoded));
bytes = bytes.concat(params[key]);
bytes = bytes.concat(bufferToArray(params[key]));
} else if (typeof params[key] === 'object') {
if (Array.isArray(params[key])) {
var ret = [];
params[key].forEach(function (item) {
ret.push(self.encode(schema[key].raw_type, item));
});
params[key] = ret.map(function (item) {
var arr = bufferToArray(item),
len = bufferToArray(encode(arr.length)),
head = [(schema[key].field << 3) + schema[key].type];
return head.concat(len).concat(arr);
}).reduce(function (a, b) {
return a.concat(b);
});
bytes = bytes.concat(params[key]);
} else {
params[key] = self.encode(schema[key].raw_type, params[key]);
params[key] = bufferToArray(params[key]);
bytes.push((schema[key].field << 3) + schema[key].type);
var encoded = encode(params[key].length);
bytes = bytes.concat(bufferToArray(encoded));
bytes = bytes.concat(params[key]);
}
} else {
bytes.push((schema[key].field << 3) + schema[key].type);
var encoded = encode(Buffer.byteLength(params[key]));

@@ -232,2 +251,3 @@ for (var i = 0; i < encoded.length; i++) {

} else if (schema[key].type === 0) {
bytes.push((schema[key].field << 3) + schema[key].type);
var msg = encode(params[key]);

@@ -234,0 +254,0 @@ msg = bufferToArray(msg);

{
"name": "protobuf.js",
"version": "0.0.5",
"version": "0.0.6",
"description": "a pure javascript protocol buffer encoding implementation, written specifically for riak",

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

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