Skip to content

Instantly share code, notes, and snippets.

@DanShappir
Created November 1, 2020 10:09
Show Gist options
  • Save DanShappir/cd68433732ec1067e9d0e05d108e1462 to your computer and use it in GitHub Desktop.
Save DanShappir/cd68433732ec1067e9d0e05d108e1462 to your computer and use it in GitHub Desktop.
forEach for use with pipe function
function forEach(op) {
return async function (src) {
let index = 0;
for await (const value of src) {
if (op(value, index++) === false) {
break;
}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment