stream-array
Advanced tools
Comparing version 1.0.2 to 1.1.0
var Readable = require('readable-stream').Readable | ||
, Queue = require('fastqueue') | ||
; | ||
@@ -11,5 +10,5 @@ | ||
this._queue = new Queue(); | ||
this._queue.tail = list; | ||
this._queue.length = list.length; | ||
this._i = 0; | ||
this._l = list.length; | ||
this._list = list; | ||
} | ||
@@ -20,3 +19,3 @@ | ||
StreamArray.prototype._read = function(size) { | ||
this.push(this._queue.length ? this._queue.shift() : null); | ||
this.push(this._i < this._l ? this._list[this._i++] : null); | ||
}; | ||
@@ -23,0 +22,0 @@ |
{ | ||
"name": "stream-array", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Pipe an Array through Node.js streams", | ||
"dependencies": { | ||
"readable-stream": "~1.1.0", | ||
"fastqueue": "~0.1.0" | ||
"readable-stream": "~1.1.0" | ||
}, | ||
@@ -9,0 +8,0 @@ "devDependencies": { |
# stream-array | ||
Pipe an Array through Node.js streams. This is rather useful for testing other | ||
streams. | ||
Pipe an Array through Node.js [Streams][12]. This is rather useful for testing | ||
other streams. | ||
[![npm version][1]][2] [![build status][3]][4] [![dependencies][5]][6] [![devDependencies][7]][8] | ||
[![npm version][1]][2] | ||
[![build status][3]][4] | ||
[![dependencies][5]][6] | ||
[![devDependencies][7]][8] | ||
@@ -24,3 +27,4 @@ [//]: [![testling][9]][10] | ||
#### streamify(Array) | ||
The result of [require][13] is a 'function' that when invoked, will return a [Readable][11] [Stream][12]. | ||
The result of [require][13] is a 'function()' that when invoked, will return a | ||
[Readable][11] [Stream][12]. | ||
@@ -31,3 +35,5 @@ ``` | ||
The Array passed into stream-array() can contain any type, as it assumes the receiving stream can handle it. Each element will be dequeued and pushed into the following piped stream. | ||
The source array can contain any type as it is assumed that the receiving | ||
stream can handle it. Each element in the array will be [pushed][14] into the | ||
[piped][15] stream, **without** modifying the source array. | ||
@@ -38,3 +44,4 @@ ``` | ||
This [Stream][12] will emit each element of the source array as chunks. | ||
This [Stream][12] will [push][14] each element of the source array into the | ||
[piped][15] array. | ||
@@ -51,3 +58,3 @@ ``` | ||
``` | ||
```sh | ||
npm install stream-array | ||
@@ -69,2 +76,4 @@ ``` | ||
[13]: http://nodejs.org/api/globals.html#globals_require | ||
[14]: https://nodejs.org/api/stream.html#stream_readable_push_chunk_encoding | ||
[15]: https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options | ||
@@ -71,0 +80,0 @@ ## License |
@@ -0,0 +0,0 @@ var test = require('tape') |
@@ -0,0 +0,0 @@ var test = require('tape') |
@@ -10,3 +10,3 @@ var test = require('tape') | ||
[null, undefined, 1, 'string', new Object(), function(){}].forEach( | ||
[null, undefined, 1, NaN, 'string', new Object(), function(){}].forEach( | ||
function(item) { | ||
@@ -13,0 +13,0 @@ t.throws(function() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8120
1
78
98
- Removedfastqueue@~0.1.0
- Removedfastqueue@0.1.0(transitive)