Skip to content

Commit

Permalink
simplify check
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Mar 9, 2024
1 parent 965f5bc commit a4e91c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions deps/streamsearch/sbmh.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ class SBMH extends EventEmitter {

// Lookbehind buffer is now empty. We only need to check if the
// needle is in the haystack.
if (data.indexOf(needle, pos) !== -1) {
pos = data.indexOf(needle, pos)
pos = data.indexOf(needle, pos)

if (pos !== -1) {
++this.matches
if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) }

return (this._bufpos = pos + needleLength)
} else {
pos = len - needleLength
}

pos = len - needleLength

// There was no match. If there's trailing haystack data that we cannot
// match yet using the Boyer-Moore-Horspool algorithm (because the trailing
// data is less than the needle size) then match using a modified
Expand Down

0 comments on commit a4e91c5

Please sign in to comment.