UNPKG

geninq

Version:

A JavaScript version of the Linq library for Generators

18 lines (15 loc) 326 B
import { Build } from "./utils"; declare global { /** * Builds a generator from an array. * @returns A generator with the same type as the array. */ interface Array<T> { geninq(): Generator<T, void, unknown>; } } Array.prototype.geninq = function* () { for (const item of this) { yield item; } };