Skip to content

Commit c86f505

Browse files
committed
Make the constrctor factories too. Bump version
1 parent 93750d6 commit c86f505

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

lib/readable-search.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ module.exports = ReadableHits;
1414
* @param queryExec an executable query functions that takes 2 arguments: the offset and a callback.
1515
*/
1616
function ReadableHits(queryExec) {
17+
if (!(this instanceof ReadableHits)) {
18+
return new ReadableHits(queryExec);
19+
}
1720
Readable.call(this, {objectMode:true});
1821
this.queryExec = queryExec;
1922
this.total = -1;

lib/transform-mget.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ module.exports = PipableDocs;
99
/**
1010
* @param mgetExec an executable query functions that takes 2 arguments:
1111
* a list of document IDs and a callback.
12-
* @param bulkSize number of bulk commands executed at once. 128 by default.
12+
* @param corkSize number of documents fetched at once. 128 by default.
1313
*/
1414
function PipableDocs(mgetExec, corkSize) {
15+
if (!(this instanceof PipableDocs)) {
16+
return new PipableDocs(mgetExec);
17+
}
1518
Transform.call(this, {objectMode:true});
1619
this.mgetExec = mgetExec;
1720
this.corkSize = corkSize;

lib/transform-to-bulk.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ module.exports = TransformToBulk;
1212
* { _index: the_index?, _type: the_type?, _id: the_id? }
1313
*/
1414
function TransformToBulk(getIndexTypeId) {
15+
if (!(this instanceof TransformToBulk)) {
16+
return new TransformToBulk(getIndexTypeId);
17+
}
1518
Transform.call(this, {objectMode:true});
1619
this.getIndexTypeId = getIndexTypeId;
1720
}

lib/writable-bulk.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ module.exports = WritableBulk;
1212
* @param highWaterMark number of bulk commands executed at once. 128 by default.
1313
*/
1414
function WritableBulk(bulkExec, highWaterMark) {
15+
if (!(this instanceof WritableBulk)) {
16+
return new WritableBulk(bulkExec, highWaterMark);
17+
}
1518
Writable.call(this, {objectMode:true});
1619
this.bulkExec = bulkExec;
1720

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "elasticsearch-streams",
33
"description": "Stream in and out of Elasticsearch",
4-
"version": "0.0.4",
4+
"version": "0.0.5",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/hmalphettes/elasticsearch-streamer.git"

0 commit comments

Comments
 (0)