Created
November 1, 2020 10:06
-
-
Save DanShappir/eac080c897639dea4044f19af1a795b3 to your computer and use it in GitHub Desktop.
forEach for use with pipeline operator
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
async function forEach(src, op) { | |
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