Skip to content

Commit

Permalink
refactor(CarNameValidator): MIN_CAR_LENGTH 네이밍 변경
Browse files Browse the repository at this point in the history
변수의 일관성을 위해 CAR_LENGTH_RANGE로 네이밍 후 객체 형태로 변경
  • Loading branch information
jinyoung234 committed Feb 16, 2024
1 parent a7debd2 commit a6b77bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/validator/carName/CarNameValidator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SYMBOLS } from '../../constants/symbols.js';
import { startValidation } from '../startValidation.js';
import { CAR_NAME_RANGE, CAR_NAME_REGEX, MIN_CAR_LENGTH } from './constant.js';
import { CAR_NAME_RANGE, CAR_NAME_REGEX, CAR_LENGTH_RANGE } from './constant.js';

/**
* @module CarNameValidator
Expand Down Expand Up @@ -28,9 +28,9 @@ const CarNameValidator = Object.freeze({
}),

invalidCarLength: Object.freeze({
errorMessage: `자동차는 ${MIN_CAR_LENGTH}대 이상 부터 가능합니다.`,
errorMessage: `자동차는 ${CAR_LENGTH_RANGE.min}대 이상 부터 가능합니다.`,
isValid(inputValue) {
return inputValue.split(SYMBOLS.comma).length >= MIN_CAR_LENGTH;
return inputValue.split(SYMBOLS.comma).length >= CAR_LENGTH_RANGE.min;
},
}),

Expand Down
4 changes: 3 additions & 1 deletion src/validator/carName/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

export const CAR_NAME_REGEX = /^[a-z0-9A-Z-]+([,][a-z0-9A-Z-]*)*[,]?$/;

export const MIN_CAR_LENGTH = 2;
export const CAR_LENGTH_RANGE = Object.freeze({
min: 2,
});

export const CAR_NAME_RANGE = Object.freeze({
min: 1,
Expand Down

0 comments on commit a6b77bd

Please sign in to comment.