Skip to content

Instantly share code, notes, and snippets.

@DanShappir
Created November 1, 2020 09:58
Show Gist options
  • Save DanShappir/45214658e46ffad32a57ba24c13a220f to your computer and use it in GitHub Desktop.
Save DanShappir/45214658e46ffad32a57ba24c13a220f to your computer and use it in GitHub Desktop.
Filter for use with pipe function
function filter(op) {
return function* (src) {
for (const value of src) {
if (op(value)) {
yield value;
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment