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

protodef

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

protodef - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

61

example.js

@@ -5,4 +5,63 @@ var ProtoDef = require("protodef").ProtoDef;

// the protocol can be in a separate json file
var example_protocol={
"container": "native",
"varint": "native",
"byte": "native",
"bool": "native",
"switch": "native",
"entity_look": [
"container",
[
{
"name": "entityId",
"type": "varint"
},
{
"name": "yaw",
"type": "byte"
},
{
"name": "pitch",
"type": "byte"
},
{
"name": "onGround",
"type": "bool"
}
]
],
"packet": [
"container",
[
{
"name": "name",
"type": [
"mapper",
{
"type": "varint",
"mappings": {
"22": "entity_look"
}
}
]
},
{
"name": "params",
"type": [
"switch",
{
"compareTo": "name",
"fields": {
"entity_look": "entity_look"
}
}
]
}
]
]
};
var proto = new ProtoDef();
proto.addTypes(require("./example_protocol.json").types);
proto.addTypes(example_protocol);
var parser = new Parser(proto, "packet");

@@ -9,0 +68,0 @@ var serializer = new Serializer(proto, "packet");

2

package.json
{
"name": "protodef",
"version": "0.2.3",
"version": "0.2.4",
"description": "A simple yet powerful way to define binary protocols",

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

@@ -114,2 +114,5 @@ # ProtoDef

### 0.2.4
* get back the example file as one file for simplicity and for tonic
### 0.2.3

@@ -116,0 +119,0 @@ * fix a small mistake in mapping error

@@ -19,4 +19,62 @@ var ITERATIONS = 100000;

proto.addTypes(require("../example_protocol.json").types);
var example_protocol={
"container": "native",
"varint": "native",
"byte": "native",
"bool": "native",
"switch": "native",
"entity_look": [
"container",
[
{
"name": "entityId",
"type": "varint"
},
{
"name": "yaw",
"type": "byte"
},
{
"name": "pitch",
"type": "byte"
},
{
"name": "onGround",
"type": "bool"
}
]
],
"packet": [
"container",
[
{
"name": "name",
"type": [
"mapper",
{
"type": "varint",
"mappings": {
"22": "entity_look"
}
}
]
},
{
"name": "params",
"type": [
"switch",
{
"compareTo": "name",
"fields": {
"entity_look": "entity_look"
}
}
]
}
]
]
};
proto.addTypes(example_protocol);
describe("benchmark",function(){

@@ -23,0 +81,0 @@ this.timeout(60 * 1000);

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