diff --git a/main.js b/main.js index 4b1a856..e7b9598 100644 --- a/main.js +++ b/main.js @@ -13,7 +13,7 @@ var streamInterval = function(opts, fn, interval) { this.stopped = true; this.push(null); }; - outStream._read = function() {}; + outStream._read = function(){}; scheduleInterval(Date.now()); return outStream; diff --git a/package.json b/package.json index 98c0272..7a88a9b 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "coveralls": "cat ./coverage/lcov.info | coveralls" }, "dependencies": { - "readable-stream": "^1.0.33" + "readable-stream": "^1.1.13" }, "devDependencies": { "chai": "^2.3.0", diff --git a/test/main.js b/test/main.js index fc83387..3463c36 100644 --- a/test/main.js +++ b/test/main.js @@ -54,12 +54,12 @@ describe('streamInterval', function() { it('calls the stream factory at most every x milliseconds', function(done) { var all = ''; var si = streamInterval(function() { - return new Readable({ - read: function() { - this.push('hello'); - this.push(null); - } - }); + var s = new Readable(); + s._read = function() { + this.push('hello'); + this.push(null); + }; + return s; }, 100); si.on('data', function(data) { @@ -79,9 +79,8 @@ describe('streamInterval', function() { var si = streamInterval(function() { calls++; - var s = new Readable({ - read: function(){} - }); + var s = new Readable(); + s._read = function(){}; setTimeout(function() { s.push('hello'); @@ -107,13 +106,11 @@ describe('streamInterval', function() { function threeObjects() { var i = 0; var si = streamInterval({ objectMode: true }, function() { - var s = new Readable({ - objectMode: true, - read: function() { - this.push({ hello: 'world' }); - this.push(null); - } - }); + var s = new Readable({ objectMode: true }); + s._read = function() { + this.push({ hello: 'world' }); + this.push(null); + }; if (++i > 3) si.stop(); return s; }); @@ -123,12 +120,11 @@ function threeObjects() { function threeHellos() { var i = 0; var si = streamInterval(function() { - var s = new Readable({ - read: function() { - this.push('hello'); - this.push(null); - } - }); + var s = new Readable(); + s._read = function() { + this.push('hello'); + this.push(null); + }; if (++i > 3) si.stop(); return s; });