import { IEnumerable, IEnumerableFactory } from '../../types'; export function applyRepeat( factory: IEnumerableFactory, element: TResult, count: number ): IEnumerable { if (count < 0) { throw new Error('Count must be greater than or equal to 0'); } function* generator(): Generator { for (let i = 0; i < count; i++) { yield element; } } return factory.createBasicEnumerable(generator); }