fix linting

This commit is contained in:
Oliver Rahner 2022-07-21 14:00:37 +02:00
parent eda9a40aa2
commit a0546c8a3d
No known key found for this signature in database
GPG key ID: 8658521FC5B6D857
2 changed files with 22 additions and 14 deletions

View file

@ -116,16 +116,22 @@ class Protobuf {
return this.mergeDecodes(input); return this.mergeDecodes(input);
} }
/**
* Parse Protobuf stream data
* @param {byteArray} input
* @param {any[]} args
* @returns {any[]}
*/
static decodeStream(input, args) { static decodeStream(input, args) {
this.updateProtoRoot(args[0]); this.updateProtoRoot(args[0]);
this.showUnknownFields = args[1]; this.showUnknownFields = args[1];
this.showTypes = args[2]; this.showTypes = args[2];
let streams = new Protobuf(input); const streams = new Protobuf(input);
let output = []; const output = [];
let objLength = streams._varInt(); let objLength = streams._varInt();
while (!isNaN(objLength) && objLength > 0) { while (!isNaN(objLength) && objLength > 0) {
let subData = streams.data.slice(streams.offset, streams.offset + objLength); const subData = streams.data.slice(streams.offset, streams.offset + objLength);
output.push(this.mergeDecodes(subData)); output.push(this.mergeDecodes(subData));
streams.offset += objLength; streams.offset += objLength;
objLength = streams._varInt(); objLength = streams._varInt();

View file

@ -306,7 +306,8 @@ TestRegister.addTests([
{ {
name: "Protobuf Stream Decode: no schema", name: "Protobuf Stream Decode: no schema",
input: "0d081c1203596f751a024d65202b0c0a0a0a066162633132331200", input: "0d081c1203596f751a024d65202b0c0a0a0a066162633132331200",
expectedOutput: JSON.stringify([{ expectedOutput: JSON.stringify([
{
"1": 28, "1": 28,
"2": "You", "2": "You",
"3": "Me", "3": "Me",
@ -317,7 +318,8 @@ TestRegister.addTests([
"1": "abc123", "1": "abc123",
"2": {} "2": {}
} }
}], null, 4), }
], null, 4),
recipeConfig: [ recipeConfig: [
{ {
"op": "From Hex", "op": "From Hex",