git ssb

2+

Dominic / pull-stream



Commit a81d5b4839992b6e494921404deee61709e162bf

Update docs

nichoth authored on 10/13/2016, 10:57:56 PM
GitHub committed on 10/13/2016, 10:57:56 PM
Parent: 4820f821d54b2ca1d9ea1519cc0f56cd89b7fe98

Files changed

docs/throughs/flatten.mdchanged
docs/throughs/flatten.mdView
@@ -1,9 +1,44 @@
11 # pull-stream/throughs/flatten
22
3+`flatten = require('pull-stream/throughs/flatten')`
4+
5+## example
6+```js
7+test('flatten arrays', function (t) {
8+ pull(
9+ pull.values([
10+ [1, 2, 3],
11+ [4, 5, 6],
12+ [7, 8, 9]
13+ ]),
14+ pull.flatten(),
15+ pull.collect(function (err, numbers) {
16+ t.deepEqual([1, 2, 3, 4, 5, 6, 7, 8, 9], numbers)
17+ t.end()
18+ })
19+ )
20+})
21+
22+test('flatten stream of streams', function (t) {
23+
24+ pull(
25+ pull.values([
26+ pull.values([1, 2, 3]),
27+ pull.values([4, 5, 6]),
28+ pull.values([7, 8, 9])
29+ ]),
30+ pull.flatten(),
31+ pull.collect(function (err, numbers) {
32+ t.deepEqual([1, 2, 3, 4, 5, 6, 7, 8, 9], numbers)
33+ t.end()
34+ })
35+ )
36+
37+})
38+```
39+
340 ## usage
441
5-### `flatten = require('pull-stream/throughs/flatten')`
42+### `flatten(streams)`
643
7-### `flatten()`
8-
944 Turn a stream of streams or a stream of arrays into a stream of their items, (undoes group).

Built with git-ssb-web