Last active
April 21, 2017 15:18
-
-
Save mattpodwysocki/ae6ccace2e1eb835e7fa2d5284b6245a to your computer and use it in GitHub Desktop.
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<T>(iterable: AsyncIterable<T>, fn: (value: T, index: number) => void, thisArg?: any): Promise<void> { | |
const fun = fn.bind(thisArg); | |
let i = 0; | |
for await (let item of iterable) { | |
fun(item, i++); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment