Created
September 24, 2014 23:10
-
-
Save davidbanham/0d81359ed4d8c4a784dc to your computer and use it in GitHub Desktop.
You can totally pass functions in a document stream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t2 = require 'through2' | |
one = t2.obj (doc, enc, cb) -> | |
doc.speak() | |
doc.foo = -> | |
console.log 'foo' | |
@push doc | |
cb() | |
two = t2.obj (doc, enc, cb) -> | |
doc.foo() | |
@push doc | |
cb() | |
one.pipe two | |
one.write {speak: -> console.log 'hai'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment