Skip to content

Commit 0d227ab

Browse files
committed
remove the Option to simplify code
1 parent b6a105f commit 0d227ab

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

Messerli.ChangeCase/StringCaseExtensions.Private.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private static string JoinStrings(this IEnumerable<string> strings, string separ
105105

106106
private static IEnumerable<string> SplitBy(this string text, ExtractElement extractNext)
107107
=> Sequence
108-
.Generate(new SplitResult(0), previous => extractNext(text, previous.NextStartIndex))
108+
.Generate(new SplitResult(0, string.Empty), previous => extractNext(text, previous.NextStartIndex))
109109
.Select(r => r.Result);
110110

111111
private static int GetIndex(ValueWithIndex<char> value)

Messerli.ChangeCase/StringCaseExtensions.SplitResult.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ private readonly struct SplitResult
1010

1111
public readonly int NextStartIndex;
1212

13-
public SplitResult(int nextStartIndex, Option<string> result = default)
14-
=> (Result, NextStartIndex) = (FlattenResult(result), nextStartIndex);
15-
16-
private static string FlattenResult(Option<string> result)
17-
=> result
18-
.Match(
19-
none: string.Empty,
20-
some: ToLower);
13+
public SplitResult(int nextStartIndex, string result)
14+
=> (Result, NextStartIndex) = (result.ToLower(), nextStartIndex);
2115
}
2216
}
2317
}

0 commit comments

Comments
 (0)