Skip to content

Instantly share code, notes, and snippets.

@jbenet
Created June 30, 2014 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbenet/e77066afffe8276b66ca to your computer and use it in GitHub Desktop.
Save jbenet/e77066afffe8276b66ca to your computer and use it in GitHub Desktop.
// say i have a pipeline of streams:
a.pipe(b).pipe(c).pipe(d)
// and these process objects, like
{ foo: "hello", bar: 55 }
// say i have a magical number processing stream, like "square" which only takes + emits numbers.
square.write(5) // emits 25
// And i want to set it up between b and c above. so like
a.pipe(b).pipe(square).pipe(c).pipe(d)
// but this doesn't work because that stream only takes numbers.
// how can i "wrap" the nums stream, to invoke its square magic
// only with the number part of an object?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment