feat: Add block breaking indicators to jade

This commit is contained in:
Linnea Gräf
2025-03-07 00:21:38 +01:00
parent 6ad259ca40
commit b4a93bd751
10 changed files with 101 additions and 39 deletions

View File

@@ -16,12 +16,13 @@ import kotlin.time.Duration.Companion.seconds
inline fun <T> String.ifMatches(regex: Regex, block: (MatchResult) -> T): T? =
regex.matchEntire(this)?.let(block)
inline fun <T> Pattern.useMatch(string: String, block: Matcher.() -> T): T? {
inline fun <T> Pattern.useMatch(string: String?, block: Matcher.() -> T): T? {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
}
return matcher(string)
.takeIf(Matcher::matches)
return string
?.let(this::matcher)
?.takeIf(Matcher::matches)
?.let(block)
}