Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

protobufjs

Package Overview
Dependencies
Maintainers
1
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protobufjs - npm Package Compare versions

Comparing version 0.12.12 to 0.12.13

2

package.json
{
"name": "protobufjs",
"version": "0.12.12",
"version": "0.12.13",
"description": "ProtoBuf.js: protobuf for JavaScript. No compilation step required, works out of the box.",

@@ -5,0 +5,0 @@ "author": "Daniel Wirtz <dcode@dcode.io>",

@@ -6,3 +6,3 @@ /*

*/
(function(p){function q(n){if(!n||!n.zigZagEncode32)throw Error("ProtoBuf.js requires ByteBuffer.js >=1.1.0: Get it at https://github.com/dcodeIO/ByteBuffer.js");var f={VERSION:"0.12.12",WIRE_TYPES:{}};f.WIRE_TYPES.VARINT=0;f.WIRE_TYPES.BITS64=1;f.WIRE_TYPES.LDELIM=2;f.WIRE_TYPES.STARTGROUP=3;f.WIRE_TYPES.ENDGROUP=4;f.WIRE_TYPES.BITS32=5;f.TYPES={int32:{name:"int32",wireType:f.WIRE_TYPES.VARINT},uint32:{name:"uint32",wireType:f.WIRE_TYPES.VARINT},sint32:{name:"sint32",wireType:f.WIRE_TYPES.VARINT},
(function(p){function q(n){if(!n||!n.zigZagEncode32)throw Error("ProtoBuf.js requires ByteBuffer.js >=1.1.0: Get it at https://github.com/dcodeIO/ByteBuffer.js");var f={VERSION:"0.12.13",WIRE_TYPES:{}};f.WIRE_TYPES.VARINT=0;f.WIRE_TYPES.BITS64=1;f.WIRE_TYPES.LDELIM=2;f.WIRE_TYPES.STARTGROUP=3;f.WIRE_TYPES.ENDGROUP=4;f.WIRE_TYPES.BITS32=5;f.TYPES={int32:{name:"int32",wireType:f.WIRE_TYPES.VARINT},uint32:{name:"uint32",wireType:f.WIRE_TYPES.VARINT},sint32:{name:"sint32",wireType:f.WIRE_TYPES.VARINT},
int64:{name:"int64",wireType:f.WIRE_TYPES.VARINT},uint64:{name:"uint64",wireType:f.WIRE_TYPES.VARINT},sint64:{name:"sint64",wireType:f.WIRE_TYPES.VARINT},bool:{name:"bool",wireType:f.WIRE_TYPES.VARINT},"double":{name:"double",wireType:f.WIRE_TYPES.BITS64},string:{name:"string",wireType:f.WIRE_TYPES.LDELIM},bytes:{name:"bytes",wireType:f.WIRE_TYPES.LDELIM},fixed32:{name:"fixed32",wireType:f.WIRE_TYPES.BITS32},sfixed32:{name:"sfixed32",wireType:f.WIRE_TYPES.BITS32},fixed64:{name:"fixed64",wireType:f.WIRE_TYPES.BITS64},

@@ -47,3 +47,3 @@ sfixed64:{name:"sfixed64",wireType:f.WIRE_TYPES.BITS64},"float":{name:"float",wireType:f.WIRE_TYPES.BITS32},"enum":{name:"enum",wireType:f.WIRE_TYPES.VARINT},message:{name:"message",wireType:f.WIRE_TYPES.LDELIM}};f.Long=n.Long;f.Util=function(){Object.create||(Object.create=function(b){function c(){}if(1<arguments.length)throw Error("Object.create implementation only accepts the first parameter.");c.prototype=b;return new c});var c={};c.IS_NODE=("undefined"==typeof window||!window.window)&&"function"==

a+" ("+p+")");}return b};d.prototype.encodeValue=function(a,b){if(null!==a){if(this.type==c.TYPES.int32||this.type==c.TYPES.uint32)b.writeVarint32(a);else if(this.type==c.TYPES.sint32)b.writeZigZagVarint32(a);else if(this.type==c.TYPES.fixed32)b.writeUint32(a);else if(this.type==c.TYPES.sfixed32)b.writeInt32(a);else if(this.type==c.TYPES.int64||this.type==c.TYPES.uint64)b.writeVarint64(a);else if(this.type==c.TYPES.sint64)b.writeZigZagVarint64(a);else if(this.type==c.TYPES.fixed64)b.writeUint64(a);
else if(this.type==c.TYPES.sfixed64)b.writeInt64(a);else if(this.type==c.TYPES.bool)b.writeVarint32(a?1:0);else if(this.type==c.TYPES["enum"])b.writeVarint32(a);else if(this.type==c.TYPES["float"])b.writeFloat32(a);else if(this.type==c.TYPES["double"])b.writeFloat64(a);else if(this.type==c.TYPES.string)b.writeVString(a);else if(this.type==c.TYPES.bytes)a.offset>a.length&&(b=b.clone().flip()),b.writeVarint32(a.remaining()),b.append(a);else if(this.type==c.TYPES.message){var d=new n;this.resolvedType.encode(a,
else if(this.type==c.TYPES.sfixed64)b.writeInt64(a);else if(this.type==c.TYPES.bool)b.writeVarint32(a?1:0);else if(this.type==c.TYPES["enum"])b.writeVarint32(a);else if(this.type==c.TYPES["float"])b.writeFloat32(a);else if(this.type==c.TYPES["double"])b.writeFloat64(a);else if(this.type==c.TYPES.string)b.writeVString(a);else if(this.type==c.TYPES.bytes)a.offset>a.length&&(b=b.clone().flip()),b.writeVarint32(a.remaining()),b.append(a);else if(this.type==c.TYPES.message){var d=(new n).LE();this.resolvedType.encode(a,
d);b.writeVarint32(d.offset);b.append(d.flip())}else throw Error("[INTERNAL ERROR] Illegal value to encode in "+this.toString(!0)+": "+a+" (unknown type)");return b}};d.prototype.decode=function(a,b,d){if(a!=this.type.wireType&&(d||a!=c.WIRE_TYPES.LDELIM||!this.repeated))throw Error("Illegal wire type for field "+this.toString(!0)+": "+a+" ("+this.type.wireType+" expected)");if(a==c.WIRE_TYPES.LDELIM&&(this.repeated&&this.options.packed)&&!d){a=b.readVarint32();a=b.offset+a;for(d=[];b.offset<a;)d.push(this.decode(this.type.wireType,

@@ -50,0 +50,0 @@ b,!0));return d}if(this.type==c.TYPES.int32)return b.readVarint32()|0;if(this.type==c.TYPES.uint32)return b.readVarint32()>>>0;if(this.type==c.TYPES.sint32)return b.readZigZagVarint32()|0;if(this.type==c.TYPES.fixed32)return b.readUint32()>>>0;if(this.type==c.TYPES.sfixed32)return b.readInt32()|0;if(this.type==c.TYPES.int64)return b.readVarint64();if(this.type==c.TYPES.uint64)return b.readVarint64().toUnsigned();if(this.type==c.TYPES.sint64)return b.readZigZagVarint64();if(this.type==c.TYPES.fixed64)return b.readUint64();

@@ -6,3 +6,3 @@ /*

*/
(function(p){function q(l){if(!l||!l.zigZagEncode32)throw Error("ProtoBuf.js requires ByteBuffer.js >=1.1.0: Get it at https://github.com/dcodeIO/ByteBuffer.js");var f={VERSION:"0.12.12",WIRE_TYPES:{}};f.WIRE_TYPES.VARINT=0;f.WIRE_TYPES.BITS64=1;f.WIRE_TYPES.LDELIM=2;f.WIRE_TYPES.STARTGROUP=3;f.WIRE_TYPES.ENDGROUP=4;f.WIRE_TYPES.BITS32=5;f.TYPES={int32:{name:"int32",wireType:f.WIRE_TYPES.VARINT},uint32:{name:"uint32",wireType:f.WIRE_TYPES.VARINT},sint32:{name:"sint32",wireType:f.WIRE_TYPES.VARINT},
(function(p){function q(l){if(!l||!l.zigZagEncode32)throw Error("ProtoBuf.js requires ByteBuffer.js >=1.1.0: Get it at https://github.com/dcodeIO/ByteBuffer.js");var f={VERSION:"0.12.13",WIRE_TYPES:{}};f.WIRE_TYPES.VARINT=0;f.WIRE_TYPES.BITS64=1;f.WIRE_TYPES.LDELIM=2;f.WIRE_TYPES.STARTGROUP=3;f.WIRE_TYPES.ENDGROUP=4;f.WIRE_TYPES.BITS32=5;f.TYPES={int32:{name:"int32",wireType:f.WIRE_TYPES.VARINT},uint32:{name:"uint32",wireType:f.WIRE_TYPES.VARINT},sint32:{name:"sint32",wireType:f.WIRE_TYPES.VARINT},
int64:{name:"int64",wireType:f.WIRE_TYPES.VARINT},uint64:{name:"uint64",wireType:f.WIRE_TYPES.VARINT},sint64:{name:"sint64",wireType:f.WIRE_TYPES.VARINT},bool:{name:"bool",wireType:f.WIRE_TYPES.VARINT},"double":{name:"double",wireType:f.WIRE_TYPES.BITS64},string:{name:"string",wireType:f.WIRE_TYPES.LDELIM},bytes:{name:"bytes",wireType:f.WIRE_TYPES.LDELIM},fixed32:{name:"fixed32",wireType:f.WIRE_TYPES.BITS32},sfixed32:{name:"sfixed32",wireType:f.WIRE_TYPES.BITS32},fixed64:{name:"fixed64",wireType:f.WIRE_TYPES.BITS64},

@@ -31,3 +31,3 @@ sfixed64:{name:"sfixed64",wireType:f.WIRE_TYPES.BITS64},"float":{name:"float",wireType:f.WIRE_TYPES.BITS32},"enum":{name:"enum",wireType:f.WIRE_TYPES.VARINT},message:{name:"message",wireType:f.WIRE_TYPES.LDELIM}};f.Long=l.Long;f.Util=function(){Object.create||(Object.create=function(d){function k(){}if(1<arguments.length)throw Error("Object.create implementation only accepts the first parameter.");k.prototype=d;return new k});var d={};d.IS_NODE=("undefined"==typeof window||!window.window)&&"function"==

c+" ("+n+")");}return b};m.prototype.encodeValue=function(c,b){if(null!==c){if(this.type==d.TYPES.int32||this.type==d.TYPES.uint32)b.writeVarint32(c);else if(this.type==d.TYPES.sint32)b.writeZigZagVarint32(c);else if(this.type==d.TYPES.fixed32)b.writeUint32(c);else if(this.type==d.TYPES.sfixed32)b.writeInt32(c);else if(this.type==d.TYPES.int64||this.type==d.TYPES.uint64)b.writeVarint64(c);else if(this.type==d.TYPES.sint64)b.writeZigZagVarint64(c);else if(this.type==d.TYPES.fixed64)b.writeUint64(c);
else if(this.type==d.TYPES.sfixed64)b.writeInt64(c);else if(this.type==d.TYPES.bool)b.writeVarint32(c?1:0);else if(this.type==d.TYPES["enum"])b.writeVarint32(c);else if(this.type==d.TYPES["float"])b.writeFloat32(c);else if(this.type==d.TYPES["double"])b.writeFloat64(c);else if(this.type==d.TYPES.string)b.writeVString(c);else if(this.type==d.TYPES.bytes)c.offset>c.length&&(b=b.clone().flip()),b.writeVarint32(c.remaining()),b.append(c);else if(this.type==d.TYPES.message){var a=new l;this.resolvedType.encode(c,
else if(this.type==d.TYPES.sfixed64)b.writeInt64(c);else if(this.type==d.TYPES.bool)b.writeVarint32(c?1:0);else if(this.type==d.TYPES["enum"])b.writeVarint32(c);else if(this.type==d.TYPES["float"])b.writeFloat32(c);else if(this.type==d.TYPES["double"])b.writeFloat64(c);else if(this.type==d.TYPES.string)b.writeVString(c);else if(this.type==d.TYPES.bytes)c.offset>c.length&&(b=b.clone().flip()),b.writeVarint32(c.remaining()),b.append(c);else if(this.type==d.TYPES.message){var a=(new l).LE();this.resolvedType.encode(c,
a);b.writeVarint32(a.offset);b.append(a.flip())}else throw Error("[INTERNAL ERROR] Illegal value to encode in "+this.toString(!0)+": "+c+" (unknown type)");return b}};m.prototype.decode=function(c,b,a){if(c!=this.type.wireType&&(a||c!=d.WIRE_TYPES.LDELIM||!this.repeated))throw Error("Illegal wire type for field "+this.toString(!0)+": "+c+" ("+this.type.wireType+" expected)");if(c==d.WIRE_TYPES.LDELIM&&(this.repeated&&this.options.packed)&&!a){c=b.readVarint32();c=b.offset+c;for(a=[];b.offset<c;)a.push(this.decode(this.type.wireType,

@@ -34,0 +34,0 @@ b,!0));return a}if(this.type==d.TYPES.int32)return b.readVarint32()|0;if(this.type==d.TYPES.uint32)return b.readVarint32()>>>0;if(this.type==d.TYPES.sint32)return b.readZigZagVarint32()|0;if(this.type==d.TYPES.fixed32)return b.readUint32()>>>0;if(this.type==d.TYPES.sfixed32)return b.readInt32()|0;if(this.type==d.TYPES.int64)return b.readVarint64();if(this.type==d.TYPES.uint64)return b.readVarint64().toUnsigned();if(this.type==d.TYPES.sint64)return b.readZigZagVarint64();if(this.type==d.TYPES.fixed64)return b.readUint64();

@@ -488,8 +488,7 @@ ![ProtoBuf.js - protobuf for JavaScript](https://raw.github.com/dcodeIO/ProtoBuf.js/master/ProtoBuf.png)

* [View source](https://github.com/dcodeIO/ProtoBuf.js/blob/master/tests/suite.js)
* [View node report](https://travis-ci.org/dcodeIO/ProtoBuf.js)
* [View browser report](http://htmlpreview.github.com/?http://github.com/dcodeIO/ProtoBuf.js/master/tests/suite.html)
* [View report](https://travis-ci.org/dcodeIO/ProtoBuf.js)
Contributors
------------
[Frank Xu](https://github.com/yyfrankyy)
[Frank Xu](https://github.com/yyfrankyy), [Dretch](https://github.com/Dretch), [shirmin](https://github.com/shirmin)

@@ -496,0 +495,0 @@ License

@@ -982,3 +982,3 @@ // #ifdef UNDEFINED

} else if (this.type == ProtoBuf.TYPES["message"]) {
var bb = new ByteBuffer();
var bb = new ByteBuffer().LE();
this.resolvedType.encode(value, bb);

@@ -985,0 +985,0 @@ buffer.writeVarint32(bb.offset);

@@ -387,2 +387,17 @@ /*

test.done();
},
"float": function(test) {
try {
var builder = ProtoBuf.protoFromString("message Foo { required Bar bar = 1; } message Bar { required float baz = 1; }");
var root = builder.build();
var foo = new root.Foo(new root.Bar(4));
var bb = foo.encode();
var foo2 = root.Foo.decode(bb);
test.equal(foo.bar.baz, 4);
test.equal(foo2.bar.baz, foo.bar.baz);
} catch (e) {
fail(e);
}
test.done();
}

@@ -389,0 +404,0 @@

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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