Commit bab77ca73dbcc785d686760316226664577522bc
change map example to use flatten
mix irving committed on 10/23/2016, 5:49:58 AMParent: 2be98937cd98f834eb1c89fd7cc15df13c8b2acb
Files changed
README.md | changed |
package.json | changed |
test.js | changed |
README.md | ||
---|---|---|
@@ -6,9 +6,8 @@ | ||
6 | 6 … | |
7 | 7 … | ```js |
8 | 8 … | const h = require('pull-hyperscript') |
9 | 9 … | const pull = require('pull-stream') |
10 | -const catMap = require('pull-cat-map') | |
11 | 10 … | |
12 | 11 … | pull( |
13 | 12 … | h('div', {class: 'i'}, [ |
14 | 13 … | h('div', {}, [ |
@@ -25,9 +24,10 @@ | ||
25 | 24 … | pull( |
26 | 25 … | h('div', {class: 'i'}, pull( |
27 | 26 … | pull.values(['yes', null, 'non']), |
28 | 27 … | pull.filter(Boolean), |
29 | - catMap(val => h('p', val)) | |
28 … | + map(val => h('p', val)), | |
29 … | + flatten() // NB: flatten turns a stream of streams into a single stream | |
30 | 30 … | )), |
31 | 31 … | pull.concat((err, html) => { |
32 | 32 … | if (err) throw err |
33 | 33 … | var expected = '<div class="i"><p>yes</p><p>non</p></div>' |
package.json | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 … | { |
2 | 2 … | "name": "pull-hyperscript", |
3 | - "version": "0.0.2", | |
3 … | + "version": "0.0.3", | |
4 | 4 … | "description": "hyperscript as a pull-stream source", |
5 | 5 … | "keywords": [ |
6 | 6 … | "hyperscript", |
7 | 7 … | "pull-stream", |
@@ -33,8 +33,7 @@ | ||
33 | 33 … | }, |
34 | 34 … | "devDependencies": { |
35 | 35 … | "standard": "^8.4.0", |
36 | 36 … | "tap-diff": "^0.1.1", |
37 | - "tape": "^4.6.2", | |
38 | - "pull-cat-map": "^1.0.0" | |
37 … | + "tape": "^4.6.2" | |
39 | 38 … | } |
40 | 39 … | } |
test.js | ||
---|---|---|
@@ -1,7 +1,6 @@ | ||
1 | 1 … | var test = require('tape') |
2 | 2 … | var pull = require('pull-stream') |
3 | -var catMap = require('pull-cat-map') | |
4 | 3 … | |
5 | 4 … | var h = require('./') |
6 | 5 … | |
7 | 6 … | test('string child', t => { |
@@ -85,9 +84,10 @@ | ||
85 | 84 … | pull( |
86 | 85 … | h('div', {class: 'i'}, pull( |
87 | 86 … | pull.values(['yes', null, 'non']), |
88 | 87 … | pull.filter(Boolean), |
89 | - catMap(val => h('p', val)) | |
88 … | + pull.map(val => h('p', val)), | |
89 … | + pull.flatten() | |
90 | 90 … | )), |
91 | 91 … | pull.concat((err, html) => { |
92 | 92 … | if (err) throw err |
93 | 93 … | var expected = '<div class="i"><p>yes</p><p>non</p></div>' |
Built with git-ssb-web