Created
November 1, 2020 10:09
-
-
Save DanShappir/cd68433732ec1067e9d0e05d108e1462 to your computer and use it in GitHub Desktop.
forEach for use with pipe function
This file contains 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
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