Comparing version 1.15.0 to 1.16.0
# History | ||
## 1.16.0 | ||
* update protodef definitions | ||
* Replace varint assert with exception | ||
## 1.15.0 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "protodef", | ||
"version": "1.15.0", | ||
"version": "1.16.0", | ||
"description": "A simple yet powerful way to define binary protocols", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"author": "roblabla <robinlambertz.dev@gmail.com>", | ||
@@ -20,3 +21,3 @@ "scripts": { | ||
"protodef-validator": "^1.3.0", | ||
"readable-stream": "^3.0.3" | ||
"readable-stream": "^4.4.0" | ||
}, | ||
@@ -38,6 +39,6 @@ "engines": { | ||
"jsonschema": "^1.2.4", | ||
"mocha": "^5.2.0", | ||
"mocha": "^10.2.0", | ||
"protodef": "file:.", | ||
"standard": "^16.0.3" | ||
"standard": "^17.0.0" | ||
} | ||
} |
@@ -23,3 +23,3 @@ ## Structures | ||
### **container** ([ { name: String, type: Type }, ... ]) | ||
### **container** ([ { name: String, type: Type, ?anon: Bool }, ... ]) | ||
Arguments: | ||
@@ -29,2 +29,3 @@ * [array] : a field | ||
* * type : the type of field | ||
* * anon : optional (either anon or name), a boolean to make field anonymous (also known as [unnamed field](https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html)) | ||
@@ -40,4 +41,9 @@ Represents a list of named values. | ||
{ "name": "z", "type": "i32" }, | ||
{ "name": "bitMap", "type": "u16" }, | ||
{ "name": "addBitMap", "type": "u16" } | ||
{ "anon": true, "type": [ | ||
"container", | ||
[ | ||
{ "name": "bitMap", "type": "u16" }, | ||
{ "name": "addBitMap", "type": "u16" } | ||
] | ||
] } | ||
] | ||
@@ -48,2 +54,4 @@ ] | ||
**Note**: At the time of writing, implementations have limited support of `anon`. | ||
### **count** ({ type: Type, countFor: Field }) | ||
@@ -66,2 +74,2 @@ Arguments: | ||
``` | ||
Example of value: `4` | ||
Example of value: `4` |
@@ -6,2 +6,4 @@ { | ||
"cstring": { | ||
"title": "cstring", | ||
"type": "array", | ||
"items": [ | ||
@@ -8,0 +10,0 @@ { |
@@ -92,4 +92,4 @@ const { PartialReadError } = require('../utils') | ||
return { | ||
value: value, | ||
size: size | ||
value, | ||
size | ||
} | ||
@@ -96,0 +96,0 @@ } |
@@ -1,3 +0,1 @@ | ||
const assert = require('assert') | ||
const { getCount, sendCount, calcCount, PartialReadError } = require('../utils') | ||
@@ -32,3 +30,3 @@ | ||
return { | ||
size: size, | ||
size, | ||
value: mappedValue | ||
@@ -81,3 +79,3 @@ } | ||
shift += 7 // we only have 7 bits, MSB being the return-trigger | ||
assert.ok(shift < 64, 'varint is too big') // Make sure our shift don't overflow. | ||
if (shift > 64) throw new PartialReadError(`varint is too big: ${shift}`) // Make sure our shift don't overflow. | ||
} | ||
@@ -84,0 +82,0 @@ } |
@@ -5,3 +5,3 @@ const ProtoDef = require('./protodef') | ||
module.exports = { | ||
ProtoDef: ProtoDef, | ||
ProtoDef, | ||
Serializer: require('./serializer').Serializer, | ||
@@ -8,0 +8,0 @@ Parser: require('./serializer').Parser, |
@@ -161,3 +161,3 @@ const { getFieldInfo, tryCatch } = require('./utils') | ||
metadata: { | ||
size: size | ||
size | ||
}, | ||
@@ -164,0 +164,0 @@ buffer: buffer.slice(0, size), |
@@ -95,5 +95,5 @@ const Transform = require('readable-stream').Transform | ||
module.exports = { | ||
Serializer: Serializer, | ||
Parser: Parser, | ||
FullPacketParser: FullPacketParser | ||
Serializer, | ||
Parser, | ||
FullPacketParser | ||
} |
@@ -76,11 +76,11 @@ function getField (countField, context) { | ||
module.exports = { | ||
getField: getField, | ||
getFieldInfo: getFieldInfo, | ||
addErrorField: addErrorField, | ||
getCount: getCount, | ||
sendCount: sendCount, | ||
calcCount: calcCount, | ||
tryCatch: tryCatch, | ||
tryDoc: tryDoc, | ||
PartialReadError: PartialReadError | ||
getField, | ||
getFieldInfo, | ||
addErrorField, | ||
getCount, | ||
sendCount, | ||
calcCount, | ||
tryCatch, | ||
tryDoc, | ||
PartialReadError | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174855
63
4779
+ Addedabort-controller@3.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedreadable-stream@4.5.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedreadable-stream@^4.4.0