Skip to content

Conversation

@prgmr99
Copy link
Member

@prgmr99 prgmr99 commented Oct 31, 2025

Description

URL 친화적인 문자열 변환을 위한 slugify 함수를 추가했습니다.
블로그 포스트 URL, 파일명 생성, SEO 친화적 링크 생성 등에 활용할 수 있으며,
한글을 포함한 다국어 문자열을 안전하게 처리합니다.

새로운 기능

  • stringUtil.slugify() 함수 추가
  • 문자열을 URL 친화적인 slug 형태로 변환
  • 한글 문자 지원 (가-힣 유니코드 범위)

구현방식

  • 입력 처리: 공백을 하이픈(-)으로 변환
  • 문자 필터링: 영문자, 숫자, 한글, 하이픈만 허용
  • 정규화: 소문자 변환 및 연속 하이픈 제거
  • 엣지케이스: 앞뒤 하이픈 제거, 빈 문자열 처리

@prgmr99 prgmr99 requested a review from klmhyeonwoo October 31, 2025 04:46
@prgmr99 prgmr99 self-assigned this Oct 31, 2025
@prgmr99 prgmr99 added the enhancement New feature or request label Oct 31, 2025
@klmhyeonwoo
Copy link
Member

klmhyeonwoo commented Oct 31, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 81.64% 347 / 425
🔵 Statements 81.64% 347 / 425
🔵 Functions 97.05% 33 / 34
🔵 Branches 90.14% 128 / 142
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
package/stringUtil/slugify/index.ts 100% 100% 100% 100%
Generated in workflow #112 for commit 88bbd3e by the Vitest Coverage Report Action

expect(output).toBe("hello-world-this-is-a-test");
});

test("특수 문자가 포함된 문자열을 올바르게 변환한다.", () => {
Copy link
Member

@klmhyeonwoo klmhyeonwoo Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 테스트 케이스도 궁금할 것 같은데 추가가 가능하실까요?!

  test("slug 형태의 문자열은 그대로 slug 형태로 반환한다.", () => {
    const input = "Hello-World";
    const output = slugify(input);
    expect(output).toBe("hello-world");
  });

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오!! 한 번 테스트해볼게요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 되네요 :)

Copy link
Member

@klmhyeonwoo klmhyeonwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다! URL에 잘 쓰일 것 같은 유틸리티네요!
저는 지금 유용한 유틸함수가 왠만하면 거의 다 들어가서 조금 생각을 해봐야할 것 같아요!
그래서 이번 PR 머지 후 릴리즈 부탁드려도 될까요!

@prgmr99
Copy link
Member Author

prgmr99 commented Oct 31, 2025

고생하셨습니다! URL에 잘 쓰일 것 같은 유틸리티네요! 저는 지금 유용한 유틸함수가 왠만하면 거의 다 들어가서 조금 생각을 해봐야할 것 같아요! 그래서 이번 PR 머지 후 릴리즈 부탁드려도 될까요!

넵!! 알겠습니다 ^^7
천천히 추가하셔도 됩니다~~ 길게 가는 플젝이라..ㅎ

@klmhyeonwoo
Copy link
Member

고생하셨습니다! URL에 잘 쓰일 것 같은 유틸리티네요! 저는 지금 유용한 유틸함수가 왠만하면 거의 다 들어가서 조금 생각을 해봐야할 것 같아요! 그래서 이번 PR 머지 후 릴리즈 부탁드려도 될까요!

넵!! 알겠습니다 ^^7 천천히 추가하셔도 됩니다~~ 길게 가는 플젝이라..ㅎ

맞지요 맞지요 lodash를 이기는 그날까지,,

@prgmr99 prgmr99 force-pushed the 71-stringutil-slugify branch from edfcbd0 to 88bbd3e Compare October 31, 2025 06:06
@prgmr99 prgmr99 merged commit 527c72f into main Oct 31, 2025
1 check passed
@prgmr99 prgmr99 deleted the 71-stringutil-slugify branch October 31, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants