Skip to content

Commit

Permalink
prepublish
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Nov 12, 2023
1 parent 9cc4ec3 commit 0dab872
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/infinite.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {toAsyncIterable, toIterable} from "./transform";
import { toAsyncIterable, toIterable } from "./transform";

/**
* Count sequentially forever
Expand Down Expand Up @@ -31,18 +31,13 @@ export function* cycle<T>(iterable: Iterable<T> | Iterator<T>): Iterable<T> {
}
}


/**
* Cycle through the elements of a async iterable sequentially forever
*
* @param iterable
*/
export async function* cycleAsync<T>(
iterable:
| AsyncIterable<T>
| AsyncIterator<T>
| Iterable<T>
| Iterator<T>,
iterable: AsyncIterable<T> | AsyncIterator<T> | Iterable<T> | Iterator<T>
): AsyncIterable<T> {
const data = [];

Expand All @@ -51,7 +46,7 @@ export async function* cycleAsync<T>(
yield datum;
}

yield *cycle(data);
yield* cycle(data);
}

/**
Expand Down

0 comments on commit 0dab872

Please sign in to comment.