import { IEnumerable, IEnumerableFactory, TypeOfMember } from '../../types'; export function applyOfType( factory: IEnumerableFactory, src: Iterable, type: (new (...params: unknown[]) => TResult) | TypeOfMember ): IEnumerable { function* generator(): Generator { for (const item of src) { if (typeof type === 'string') { if (typeof item === type) { yield item; } } else { if (item instanceof type) { yield item; } } } } return factory.createBasicEnumerable(generator); }