Skip to content

Commit

Permalink
Tidy up naming/logic
Browse files Browse the repository at this point in the history
  • Loading branch information
David Dunn committed Sep 24, 2018
1 parent 0d2ab9b commit 22b498c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/Kitura/CodableRouter.swift
Expand Up @@ -615,9 +615,11 @@ extension Router {
case (true, true):
/// Precondition: Path is known to contain a : character
func pathHasSingleParamIdAsSuffix(_ path: String) -> Bool {
let parameterString = path.split(separator: ":", maxSplits: 1)
let parameter = parameterString.count > 1 ? parameterString[1] : ""
return parameter == "id"
let pathArray = path.split(separator: ":", maxSplits: 1)
if pathArray.count > 1 {
return parameter == "id"
}
return false
}

guard pathHasSingleParamIdAsSuffix(path) else {
Expand Down

0 comments on commit 22b498c

Please sign in to comment.