Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>2.4.0</Version>
<Version>2.4.1</Version>
</PropertyGroup>
</Project>
10 changes: 8 additions & 2 deletions TakasakiStudio.Lina.Common/Extensions/RuleBuilderExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public static IRuleBuilderOptions<T, string> IsCpf<T>(
return ruleBuilder.Must(BeAValidCpf);
}

public static bool BeAValidCpf(string input)
public static bool BeAValidCpf(string? input)
{
if (string.IsNullOrWhiteSpace(input))
return false;

var numbers = ToNumbers(input);
if (numbers.Length != 11 || numbers.Distinct().Count() == 1)
return false;
Expand All @@ -43,8 +46,11 @@ public static bool BeAValidCpf(string input)
return numbers[9] == v1 && numbers[10] == v2;
}

public static bool BeAValidCnpj(string input)
public static bool BeAValidCnpj(string? input)
{
if (string.IsNullOrWhiteSpace(input))
return false;

var numbers = ToNumbers(input);
if (numbers.Length != 14)
return false;
Expand Down