git ssb

1+

Matt McKegg / pull-hyperscript



Commit bab77ca73dbcc785d686760316226664577522bc

change map example to use flatten

mix irving committed on 10/23/2016, 5:49:58 AM
Parent: 2be98937cd98f834eb1c89fd7cc15df13c8b2acb

Files changed

README.mdchanged
package.jsonchanged
test.jschanged
README.mdView
@@ -6,9 +6,8 @@
66
77 ```js
88 const h = require('pull-hyperscript')
99 const pull = require('pull-stream')
10-const catMap = require('pull-cat-map')
1110
1211 pull(
1312 h('div', {class: 'i'}, [
1413 h('div', {}, [
@@ -25,9 +24,10 @@
2524 pull(
2625 h('div', {class: 'i'}, pull(
2726 pull.values(['yes', null, 'non']),
2827 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
3030 )),
3131 pull.concat((err, html) => {
3232 if (err) throw err
3333 var expected = '<div class="i"><p>yes</p><p>non</p></div>'
package.jsonView
@@ -1,7 +1,7 @@
11 {
22 "name": "pull-hyperscript",
3- "version": "0.0.2",
3 + "version": "0.0.3",
44 "description": "hyperscript as a pull-stream source",
55 "keywords": [
66 "hyperscript",
77 "pull-stream",
@@ -33,8 +33,7 @@
3333 },
3434 "devDependencies": {
3535 "standard": "^8.4.0",
3636 "tap-diff": "^0.1.1",
37- "tape": "^4.6.2",
38- "pull-cat-map": "^1.0.0"
37 + "tape": "^4.6.2"
3938 }
4039 }
test.jsView
@@ -1,7 +1,6 @@
11 var test = require('tape')
22 var pull = require('pull-stream')
3-var catMap = require('pull-cat-map')
43
54 var h = require('./')
65
76 test('string child', t => {
@@ -85,9 +84,10 @@
8584 pull(
8685 h('div', {class: 'i'}, pull(
8786 pull.values(['yes', null, 'non']),
8887 pull.filter(Boolean),
89- catMap(val => h('p', val))
88 + pull.map(val => h('p', val)),
89 + pull.flatten()
9090 )),
9191 pull.concat((err, html) => {
9292 if (err) throw err
9393 var expected = '<div class="i"><p>yes</p><p>non</p></div>'

Built with git-ssb-web