Skip to content

Commit

Permalink
#23 [chore] 매직 넘버 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
stellar-halo committed Jan 11, 2024
1 parent 1a95597 commit cea1e98
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ class BearNamingViewModel : ViewModel() {

fun checkIsNicknameValid() {
val nicknameLength = nickname.value?.length ?: 0
_isNickNameValid.value = nicknameLength in 1..10
_isNickNameValid.value = nicknameLength in MINIMUM_LENGTH..MAXIMUM_LENGTH
}

companion object {
private const val MINIMUM_LENGTH = 1
private const val MAXIMUM_LENGTH = 10
private const val NICKNAME_PATTERN =
"^[ㄱ-ㅣ가-힣a-zA-Z0-9\\u318D\\u119E\\u11A2\\u2022\\u2025a\\u00B7\\uFE55]+$"
val NICKNAME_REGEX: Pattern = Pattern.compile(NICKNAME_PATTERN)
Expand Down

0 comments on commit cea1e98

Please sign in to comment.