File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
var Readable = require ( 'readable-stream' ) . Readable
2
2
;
3
3
4
+ /**
5
+ * Create a new instance of StreamArray
6
+ *
7
+ * @access private
8
+ * @param {Array } list
9
+ */
4
10
function StreamArray ( list ) {
5
11
if ( ! Array . isArray ( list ) )
6
12
throw new TypeError ( 'First argument must be an Array' ) ;
@@ -14,10 +20,25 @@ function StreamArray(list) {
14
20
15
21
StreamArray . prototype = Object . create ( Readable . prototype , { constructor : { value : StreamArray } } ) ;
16
22
23
+ /**
24
+ * Read the next item from the source Array and push into NodeJS stream
25
+
26
+ * @access protected
27
+ * @desc Read the next item from the source Array and push into NodeJS stream
28
+ * @param {number } size The amount of data to read (ignored)
29
+ */
17
30
StreamArray . prototype . _read = function ( size ) {
18
31
this . push ( this . _i < this . _l ? this . _list [ this . _i ++ ] : null ) ;
19
32
} ;
20
33
34
+ /**
35
+ * Create a new instance of StreamArray
36
+ *
37
+ * @module stream-array
38
+ * @desc Push Array elements through a NodeJS stream
39
+ * @type {function }
40
+ * @param {Array } list An Array of objects, strings, numbers, etc
41
+ */
21
42
module . exports = function ( list ) {
22
43
return new StreamArray ( list ) ;
23
44
} ;
You can’t perform that action at this time.
0 commit comments