From a0546c8a3d414e87483af7ddd968e7977141d92f Mon Sep 17 00:00:00 2001 From: Oliver Rahner Date: Thu, 21 Jul 2022 14:00:37 +0200 Subject: [PATCH] fix linting --- src/core/lib/Protobuf.mjs | 12 +++++++++--- tests/operations/tests/Protobuf.mjs | 24 +++++++++++++----------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/core/lib/Protobuf.mjs b/src/core/lib/Protobuf.mjs index 6e7b5b6b..e5cae4fc 100644 --- a/src/core/lib/Protobuf.mjs +++ b/src/core/lib/Protobuf.mjs @@ -116,16 +116,22 @@ class Protobuf { return this.mergeDecodes(input); } + /** + * Parse Protobuf stream data + * @param {byteArray} input + * @param {any[]} args + * @returns {any[]} + */ static decodeStream(input, args) { this.updateProtoRoot(args[0]); this.showUnknownFields = args[1]; this.showTypes = args[2]; - let streams = new Protobuf(input); - let output = []; + const streams = new Protobuf(input); + const output = []; let objLength = streams._varInt(); 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)); streams.offset += objLength; objLength = streams._varInt(); diff --git a/tests/operations/tests/Protobuf.mjs b/tests/operations/tests/Protobuf.mjs index 5e90ec4c..fd3c36e7 100644 --- a/tests/operations/tests/Protobuf.mjs +++ b/tests/operations/tests/Protobuf.mjs @@ -306,18 +306,20 @@ TestRegister.addTests([ { name: "Protobuf Stream Decode: no schema", input: "0d081c1203596f751a024d65202b0c0a0a0a066162633132331200", - expectedOutput: JSON.stringify([{ - "1": 28, - "2": "You", - "3": "Me", - "4": 43 - }, - { - "1": { - "1": "abc123", - "2": {} + expectedOutput: JSON.stringify([ + { + "1": 28, + "2": "You", + "3": "Me", + "4": 43 + }, + { + "1": { + "1": "abc123", + "2": {} + } } - }], null, 4), + ], null, 4), recipeConfig: [ { "op": "From Hex",