목록2024/12 (5)
구어체로 설명하는 다이어리

shadcn calendar를 사용할 일이 있었는데 github bugfix가 19시간 전이라 신기해서 찍어두었습니다.기술이 바뀌고 마이그레이션하는 건 늘 있는 일이지만 작업 중 겪고 있는 이슈가 현재진행형으로 해결된 건 처음입니다. 어떤 이슈인가요? shadcn에서 calendar를 사용하면 빌드할 때 사용하지 않는 props로 인해 lint 에러가 발생합니다.하단은 calendar의 기본 코드입니다. ...components={{ IconLeft: ({ ...props }) => , IconRight: ({ ...props }) => ,}}... 이전 프로젝트를 했을 때는 { ...props } 를 아예 지워 버려 해결했던 기억이 있는데요.같은 이슈로 불편함을 겪은 사람들이 shadcn ..

단계 쪼개기 const orderData = orderString.split(/\s+/);const productPrice = priceList[orderData[0].split('-')[1]];const orderPrice = parseInt(orderData[1]) * productPrice; ▼ const orderRecord = parseOrder(order);const orderPrice = price(orderRecord, priceList);function parseOrder(aString) { const values = aString.split(/\s+/); return { productID: values[0].split("-")[1], quantity: parseInt(v..

여러 함수를 변환 함수로 묶기 function base(aReading) { ...}function taxableCharge(aReading) { ...} ▼ function enrichReading(argReading) { const aReading = _.clonedeep(argReading); aReading.baseCharge = base(aReading); aReading.taxableCharge = taxableCharge(aReading); return aReading;} 배경소프트웨어는 데이터를 입력받아서 여러 가지 정보를 도출하곤 한다. 이렇게 도출된 정보는 여러 곳에서 사용될 수 있는데, 그러다 보면 이 정보가 사용되는 곳마다 같은 도출 로직이 반복되기도 한다. 나는 ..

여러 함수를 클래스로 묶기 function base(aReading) { ...}function taxableCharge(aReading) { ...}function calculateBaseCharge(aReading) { ...} ▼ class Reading { base() { ... } taxableCharge() { ... } calculateBaseCharge() { ... }} 배경클래스는 대다수의 최신 프로그래밍 언어가 제공하는 기본적인 빌딩 블록이다. 클래스는 데이터와 함수를 하나의 공유 환경으로 묶은 후, 다른 프로그램 요소와 어우러질 수 있도록 그중 일부를 외부에 제공한다. 클래스는 객체 지향 언어의 기본인 동시에 다른 패러다임 언어에도 유용하다. ..

매개변수 객체 만들기 function amountInvoiced(startDate, endDate) {...}function amountReceived(startDate, endDate) {...}function amountOverdue(startDate, endDate) {...} ▼ function amountInvoiced(aDateRange) {...}function amountReceived(aDateRange) {...}function amountOverdue(aDateRange) {...} 배경데이터 항목 여러 개가 이 함수에서 저 함수로 함께 몰려다니는 경우를 자주 본다. 나는 이런 데이터 무리를 발견하면 데이터 구조 하나로 모아주곤 한다. 데이터 뭉치를 데이터 구조로 묶으면 데이터..