Skip to content

Commit 44cc4df

Browse files
committed
Merge pull request hmalphettes#4 from dweinstein/feature-abort-readable-search
allow aborting a readable stream using destroy
2 parents d05d0f4 + 319ce9c commit 44cc4df

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/readable-search.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ ReadableHits.prototype._shift = function() {
7272
this.push(this.parseHit(this._hits[this._current]));
7373
};
7474

75+
ReadableHits.prototype.destroy = function() {
76+
if (this.destroyed) {
77+
return;
78+
}
79+
this.destroyed = true;
80+
this._next = false;
81+
this.unpipe();
82+
};
83+
84+
7585
function identity(hit) {
7686
return hit;
7787
}

0 commit comments

Comments
 (0)