Skip to content

Commit

Permalink
[utils/createReplaceStream] trim the buffer based on the length of to…
Browse files Browse the repository at this point in the history
…Replace, not replacement
  • Loading branch information
spalger committed Oct 3, 2017
1 parent e0be3b8 commit 8ca1c33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/streams/replace_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export function createReplaceStream(toReplace, replacement) {
buffer = buffer.slice(index + toReplace.length);
}

if (buffer.length > replacement.length) {
this.push(buffer.slice(0, buffer.length - replacement.length));
buffer = buffer.slice(-replacement.length);
if (buffer.length > toReplace.length) {
this.push(buffer.slice(0, buffer.length - toReplace.length));
buffer = buffer.slice(-toReplace.length);
}

done();
Expand Down

0 comments on commit 8ca1c33

Please sign in to comment.