import { Enumerable, IEnumerable } from '../enumerable' import * as utils from '../utils' export function defaultIfEmpty(source: Iterable, defaultValue?: IEnumerable): IEnumerable { utils.throws.ThrowIfNull('source', source) let list = [...source] if (list.length) { return list } return defaultValue || Enumerable.Empty() }