Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/filter.js Secret

Created April 17, 2013 22:30
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 Raynos/fa934f471a8a895cd565 to your computer and use it in GitHub Desktop.
Save Raynos/fa934f471a8a895cd565 to your computer and use it in GitHub Desktop.
// filter := ((Value) => Boolean) => source:Stream => Stream
function filter(lambda) { return function (source) {
return source.pipe(through(function write(chunk) {
if (lambda(chunk)) {
this.push(chunk)
}
}))
} }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment