Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
590 B

using System;
using System.Linq.Expressions;
using ErsatzTV.Core;
using LanguageExt;
using static LanguageExt.Prelude;
namespace ErsatzTV
{
public static partial class Validators
{
public static Func<Expression<Func<T, int>>, Validation<BaseError, int>>
AtLeast<T>(this T input, int minimum) =>
value => Optional(value)
.Map(i => i.Compile()(input))
.Where(i => i >= minimum)
.ToValidation<BaseError>(
$"[{GetMemberName(value)}] must be greater or equal to {minimum}");
}
}