Skip to content

feat: Korean shorthand parsing — fromKorean + data-numkey-korean-entry (0.3.0)#6

Merged
jlc488 merged 1 commit into
mainfrom
feature/korean-shorthand-entry
Jul 17, 2026
Merged

feat: Korean shorthand parsing — fromKorean + data-numkey-korean-entry (0.3.0)#6
jlc488 merged 1 commit into
mainfrom
feature/korean-shorthand-entry

Conversation

@jlc488

@jlc488 jlc488 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What / 무엇

로드맵 마지막 한국 특화 기능: 만/억 축약 파싱 + 버전 0.3.0.

fromKorean(text) — toKorean의 역방향

fromKorean('3만5천')   // "35000"
fromKorean('1.5억')    // "150000000"
fromKorean('삼십오만')  // "350000"
fromKorean('9,274억 8,304만 1,001') // "927483041001" — toKorean 출력 왕복

숫자+단위(만억조경·천백십), 순한글 숫자(일이삼…), 소수 단위(1.5억), 콤마/공백/"원" 무시, 단위 단독은 1("만"→10000), 일반 숫자는 통과.

data-numkey-korean-entry — 필드에서 바로 축약 입력

한글 초안은 입력 중 건드리지 않고 (IME 조합과 안 싸움) blur에 변환: 3만5천35,000. getValuedata-numkey-name hidden 동기화는 초안 상태에서도 파싱된 값을 봅니다.

실브라우저 검증이 잡은 돈 사고 버그 🐛

한 글자씩 1.5억을 치면 — jsdom 테스트(값 통째 주입)는 통과했지만 실제 타이핑에선 — 이 도착하기 전에 정수 필드의 라이브 포맷터가 .을 먼저 제거해서 15억으로 조용히 100배 잘못 읽히는 버그. 수정:

  • 정수 필드의 소수점 초안(1.1.5)도 한글 초안과 동일한 무간섭 보호
  • settle 시 fromKorean 결과를 필드의 decimals 예산으로 클램프 (단위 없이 1.5에서 멈추고 blur → 15가 아니라 1)
  • regression 테스트는 이제 한 글자씩 타이핑으로 시뮬레이션

Verification / 검증

  • typecheck ✓ · 75 tests ✓ (14 new: 파싱 문법 전체·왕복·전각, entry 초안/블러/hidden, 100배 버그 regression 2건) · build ✓
  • 실브라우저: 1.5억 자당 입력 → 초안 유지 + 실시간 병기 "1억 5,000만" → blur 150,000,000 / 3만5천35,000 확인

머지 후 dispatch로 v0.3.0 릴리스합니다.

fromKorean(text): the inverse of toKorean, accepting what people actually
type into 부동산/주식 apps — '3만5천' → 35000, '1.5억' → 150000000,
'삼십오만' → 350000. Digits + big units (만억조경) + sub-units (천백십) +
full Hangul digits; commas/spaces/원 are noise; bare unit means 1; plain
numbers pass through. Number arithmetic — exact through the money range
(~9,000조).

data-numkey-korean-entry / koreanEntry option: shorthand entry on the field
itself. A Korean draft is left alone while typing (live reformatting would
fight the IME and eat units mid-word); blur converts and formats. getValue
and the data-numkey-name hidden sync see the parsed value even mid-draft.

Real-browser testing caught a money-losing bug the wholesale-value jsdom
tests missed: typing '1.5억' char by char on an integer field had the live
reformat strip the '.' before 억 arrived, silently reading 15억 — a 100x
error. Fix: decimal drafts on integer fields get the same no-touch
protection as Korean drafts, and fromKorean results are clamped to the
field's decimals budget on settle (bare '1.5' on an integer field blurs to
'1', not '15'). Regression tests type char-by-char now.

Version 0.3.0, bilingual CHANGELOG/README, demo card. 75 tests.
@jlc488
jlc488 merged commit ef087b8 into main Jul 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant