From cc9e4c72587d89b21fcd446ac2c067cde20b080a Mon Sep 17 00:00:00 2001 From: Ruakij Date: Thu, 2 Dec 2021 13:41:23 +0100 Subject: [PATCH] Fix flush using local vars instead of this-vars --- src/streamHandler/RegexBlockStream.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/streamHandler/RegexBlockStream.js b/src/streamHandler/RegexBlockStream.js index 7d26fd1..9ef48b9 100644 --- a/src/streamHandler/RegexBlockStream.js +++ b/src/streamHandler/RegexBlockStream.js @@ -51,11 +51,10 @@ class RegexBlockStream extends Transform{ } _flush(next){ - if(matchAllOnFlush){ // When requested, we'll match one last time over the remaining buffer - let chunk = this.readableBuffer.join(''); + if(this.matchAllOnFlush){ // When requested, we'll match one last time over the remaining buffer let chunk = this.readableBuffer.join(""); let matches = chunk.match(this.matcher); // Match remaining buffer - _writeMatches(matches); // Write matches including last element + this._writeMatches(matches); // Write matches including last element } next(); // Tell system we are done