git ssb

2+

Dominic / pull-stream



Commit 611dd81d35553e9f46997b8293c9234dedbf14ff

flattern should handle case where input is mixed of collections and non-collections

Dominic Tarr committed on 4/8/2016, 9:56:55 AM
Parent: 5869c7bbdf17510a0090e86348eee826c268b39a

Files changed

test/flatten.jschanged
throughs.jschanged
test/flatten.jsView
@@ -120,4 +120,16 @@
120120 })
121121 })
122122 })
123123
124+test('flattern handles stream with normal objects', function (t) {
125+ pull(
126+ pull.values([
127+ [1,2,3], 4, [5,6,7], 8, 9 ,10
128+ ]),
129+ pull.flatten(),
130+ pull.collect(function (err, ary) {
131+ t.deepEqual(ary, [1,2,3,4,5,6,7,8,9,10])
132+ t.end()
133+ })
134+ )
135+})
throughs.jsView
@@ -238,9 +238,9 @@
238238 return cb(end)
239239 if(Array.isArray(stream) || stream && 'object' === typeof stream)
240240 stream = sources.values(stream)
241241 else if('function' != typeof stream)
242- throw new Error('expected stream of streams')
242+ stream = sources.once(stream)
243243 _read = stream
244244 nextChunk()
245245 })
246246 }
@@ -252,4 +252,5 @@
252252
253253
254254
255255
256+

Built with git-ssb-web