using System;
using System.Collections.Generic;
using System.Linq;
using Chernobyl.Extensions;
namespace Chernobyl.Generation
{
///
/// Methods for building patterns.
///
public static class Pattern
{
///
/// Creates a function which repeats the output of a factory the specified number of times.
///
public static Func> AddRepeater(this Func factory, int count)
{
count.Throw(nameof(count)).IfLessThan(0);
return () => factory.AsEnumerable().Take(count);
}
}
}