iter-fun
Fun with Iterables
install
npm install iter-fun
usage
import { getOrCreateIterator } from "iter-fun";
const iter = getOrCreateIterator(obj);
import { isArray } from "iter-fun";
isArray([1, 2, 3]);
import { isIterator } from "iter-fun";
isIterator([1, 2, 3][Symbol.iterator]());
import { hasNext } from "iter-fun";
hasNext({ next: () => {...} });
import { hasIterator } from "iter-fun";
hasIterator({ "@@iterator": ... });
import { hasSymbolIterator } from "iter-fun";
hasSymbolIterator(Array);
import { getIterator } from "iter-fun";
const iter = getIterator([1, 2]);
iter.next();
iter.next();
iter.next()
import { createIterator } from "iter-fun";
const iter = createIterator(obj);
import { addSymbolIterator } from "iter-fun";
const obj = { next: () => {...} };
addSymbolIterator(obj);
import { addSymbolIteratorFallback } from "iter-fun";
const obj = { next: () => {...} };
addSymbolIteratorFallback(obj);
import { wrapNextFunction } from "iter-fun";
const next = () => { ... };
const iter = wrapNextFunction(next);
import { zip } from "iter-fun";
const zeros = [0, 0, 0, ...];
const twos = [2, 2, 2, ...];
const sixties = [60, 60, 60, ...];
const iters = [zeros, twos, sixties];
const zipped = zip(iters);
zipped.next();