import { IterableX } from './iterablex' ; import { defer } from './defer' ; import { empty } from './empty' ; template TSource param { ( ( ) => boolean ) } condition param { Iterable < TSource > } thenSource param { Iterable < TSource > } elseSource returns { IterableX < TSource > } export function iif < TSource > ( fn , thenSource , elseSource = empty ( ) ) { return defer < TSource > ( ( ) => ( fn ( ) ? thenSource : elseSource ) ) ; }