node-opcua-packet-assembler
Advanced tools
Comparing version 2.10.0 to 2.16.0
@@ -6,3 +6,2 @@ "use strict"; | ||
const node_opcua_assert_1 = require("node-opcua-assert"); | ||
const _ = require("underscore"); | ||
const doDebug = false; | ||
@@ -17,3 +16,3 @@ class PacketAssembler extends events_1.EventEmitter { | ||
this.minimumSizeInBytes = options.minimumSizeInBytes || 8; | ||
node_opcua_assert_1.assert(_.isFunction(this.readMessageFunc), "packet assembler requires a readMessageFunc"); | ||
node_opcua_assert_1.assert(typeof this.readMessageFunc === "function", "packet assembler requires a readMessageFunc"); | ||
} | ||
@@ -20,0 +19,0 @@ feed(data) { |
{ | ||
"name": "node-opcua-packet-assembler", | ||
"version": "2.10.0", | ||
"version": "2.16.0", | ||
"description": "pure nodejs OPCUA SDK - module -packet-assembler", | ||
@@ -15,4 +15,3 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"node-opcua-assert": "2.10.0", | ||
"underscore": "^1.10.2" | ||
"node-opcua-assert": "2.16.0" | ||
}, | ||
@@ -35,3 +34,3 @@ "devDependencies": { | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "f1c467c28f8bef1cc04ab54c57a555bd4c95ee45" | ||
"gitHead": "9fa7d50952a7c39ff6790888a2bd6f32fe46836d" | ||
} |
import { EventEmitter } from "events"; | ||
import { assert } from "node-opcua-assert"; | ||
import * as _ from "underscore"; | ||
@@ -34,3 +33,2 @@ const doDebug = false; | ||
export class PacketAssembler extends EventEmitter { | ||
private readonly _stack: Buffer[]; | ||
@@ -50,3 +48,3 @@ private expectedLength: number; | ||
this.minimumSizeInBytes = options.minimumSizeInBytes || 8; | ||
assert(_.isFunction(this.readMessageFunc), "packet assembler requires a readMessageFunc"); | ||
assert(typeof this.readMessageFunc === "function", "packet assembler requires a readMessageFunc"); | ||
} | ||
@@ -58,3 +56,2 @@ | ||
if (this.expectedLength === 0 && this.currentLength + data.length >= this.minimumSizeInBytes) { | ||
// we are at a start of a block and there is enough data provided to read the length of the block | ||
@@ -78,9 +75,6 @@ // let's build the whole data block with previous blocks already read. | ||
if (this.expectedLength === 0 || this.currentLength + data.length < this.expectedLength) { | ||
this._stack.push(data); | ||
this.currentLength += data.length; | ||
// expecting more data to complete current message chunk | ||
} else if (this.currentLength + data.length === this.expectedLength) { | ||
this.currentLength += data.length; | ||
@@ -101,3 +95,2 @@ | ||
this.emit("message", messageChunk); | ||
} else { | ||
@@ -136,3 +129,2 @@ // there is more data in this chunk than expected... | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
1
14672
238
+ Addednode-opcua-assert@2.16.0(transitive)
- Removedunderscore@^1.10.2
- Removednode-opcua-assert@2.10.0(transitive)
- Removedunderscore@1.13.7(transitive)
Updatednode-opcua-assert@2.16.0