Skip to content

Commit d370690

Browse files
Added comment
1 parent 53351e8 commit d370690

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/common/src/util/itertools.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ export function isEmptyIterable(iterable: Iterable<unknown>): boolean {
6666
return true;
6767
}
6868

69+
/**
70+
* Returns the first element of the given iterable, or `undefined` if the
71+
* iterable is empty
72+
* @param iterable The iterable to get the first element of
73+
* @returns The first element of the iterable, or `undefined` if the iterable
74+
* is empty
75+
*/
6976
export function next<T>(generator: Iterable<T>): T | undefined {
7077
for (const value of generator) {
7178
return value;

0 commit comments

Comments
 (0)