Skip to content

Commit

Permalink
Fix String.isKebabCase
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed May 10, 2024
1 parent 7ad1c4b commit d6e4c0c
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ internal fun String.isKebabCase(): Boolean {
else -> {
var prevIsHyphen = false
for (c in this) {
if (c.isSeparatorOrWordStart()) {
return false
}
val isHyphen = c == '-'
if (isHyphen && prevIsHyphen) {
if (isHyphen) {
if (prevIsHyphen) {
return false
}
} else if (c.isSeparatorOrWordStart()) {
return false
}
prevIsHyphen = isHyphen
Expand Down

0 comments on commit d6e4c0c

Please sign in to comment.