9 lines
159 B
TypeScript
9 lines
159 B
TypeScript
|
export function consumeIterator(iter: Iterator<any>) {
|
||
|
while (true) {
|
||
|
const { value, done } = iter.next()
|
||
|
if (done) {
|
||
|
return value
|
||
|
}
|
||
|
}
|
||
|
}
|