Skip to content

Commit faf219e

Browse files
committed
simpler TournamentClock.parse
1 parent 293a05c commit faf219e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

core/src/main/scala/TournamentClock.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ object TournamentClock:
1616
TournamentClock(limit, IncrementSeconds(b))
1717

1818
def apply(str: String): Option[TournamentClock] =
19-
val clean = cleanRegex.replaceAllIn(str.toLowerCase, "").replace(" ", "")
20-
clean.toIntOption
21-
.map(make(_, 0))
22-
.orElse:
23-
clean.split('+') match
24-
case Array(a, b) => (a.toIntOption, b.toIntOption).mapN(make)
25-
case _ => none
19+
cleanRegex
20+
.replaceAllIn(str.toLowerCase, "")
21+
.replace(" ", "")
22+
.split('+') match
23+
case Array(a) => a.toIntOption.map(make(_, 0))
24+
case Array(a, b) => (a.toIntOption, b.toIntOption).mapN(make)
25+
case _ => none

0 commit comments

Comments
 (0)