clone
import { clone } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/iterable.ts";Create a cloneable version of an Iterable. This caches the results of iteration, allowing the iterable to be consumed multiple times. Note: This can be memory-intensive for large or infinite iterables.
@example
import * as I from "./iterable.ts";
const generator = function* () {
yield 1;
yield 2;
yield 3;
};
const original = I.iterable(generator);
const cloned = I.clone(original);
// Can iterate multiple times
const first = Array.from(cloned); // [1, 2, 3]
const second = Array.from(cloned); // [1, 2, 3]
function clone<A>(ta: Iterable<A>): Iterable<A>;