Skip to content

Commit

Permalink
The method name in the resource handling was changed from replaceInit…
Browse files Browse the repository at this point in the history
…ialSlash to replaceLeadingSlash. The change was made for clarity, as 'leading' more accurately and unambiguously describes what the function does. This makes the codebase easier to understand and maintain.
  • Loading branch information
DRSchlaubi committed Sep 19, 2023
1 parent 0662a4d commit 2d39818
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inline fun <reified R : Any> routeHandler(body: (R) -> Unit) {
"Specified type must be resource"
}
val pattern = format.encodeToPathPattern(serializer)
if (window.location.pathname.replaceInitialSlash() != pattern) return
if (window.location.pathname.replaceLeadingSlash() != pattern) return

val parameters = window.location.search.parseUrlEncodedParameters()
val resources = format.decodeFromParameters(serializer, parameters)
Expand All @@ -48,7 +48,7 @@ inline fun <reified R : Any> ComposeRouteHandler(crossinline content: @Composabl
}

@PublishedApi
internal fun String.replaceInitialSlash() = replaceFirstChar {
internal fun String.replaceLeadingSlash() = replaceFirstChar {
if (it == '/') {
""
} else {
Expand Down

0 comments on commit 2d39818

Please sign in to comment.