Skip to content

Conversation

@ssumanlife
Copy link
Contributor

🚀 풀 리퀘스트 제안

🔍 작업 내용

number type 문자로 포맷

🔧 변경 사항

  • number type 문자로 포맷 utill 함수 추가 (number[] 인 데이터도 고려하여 두개로 나눠서 추가함)
  • 일부 코드에 적용

📸 스크린샷 (권장)

수정된 화면 또는 기능을 시연할 수 있는 스크린샷을 첨부해 주세요.

🙏 리뷰 참고 (선택 사항)

정수 4자리수 이상의 숫자만 포맷하도록 하고 아닌 것은 원래 데이터 return 하도록 적용

📄 기타 (선택 사항)

그 외 전달하고 싶은 내용이나 특별한 요구 사항이 있으면 작성해 주세요.


export const formatNumber = (data: number): string | number => {
if (data.toFixed(0).toString().length > 3) {
return data.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ',')
Copy link
Contributor

Choose a reason for hiding this comment

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

toLocaleString 이라는 메소드가 있긴한데..!

@kimpra2989 kimpra2989 temporarily deployed to feat/format-number-188 - FinalProject_team3_FE PR #194 December 3, 2024 01:30 — with Render Destroyed
Copy link
Contributor

@devdeun devdeun left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

@ghost ghost merged commit 76e491c into develop Dec 3, 2024
@ghost ghost deleted the feat/format-number-188 branch December 3, 2024 01:42
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] response number 타입 쉼표 추가하여 string으로 가공

4 participants