feat: Korean shorthand parsing — fromKorean + data-numkey-korean-entry (0.3.0)#6
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / 무엇
로드맵 마지막 한국 특화 기능: 만/억 축약 파싱 + 버전 0.3.0.
fromKorean(text)— toKorean의 역방향숫자+단위(만억조경·천백십), 순한글 숫자(일이삼…), 소수 단위(1.5억), 콤마/공백/"원" 무시, 단위 단독은 1("만"→10000), 일반 숫자는 통과.
data-numkey-korean-entry— 필드에서 바로 축약 입력한글 초안은 입력 중 건드리지 않고 (IME 조합과 안 싸움) blur에 변환:
3만5천→35,000.getValue와data-numkey-namehidden 동기화는 초안 상태에서도 파싱된 값을 봅니다.실브라우저 검증이 잡은 돈 사고 버그 🐛
한 글자씩
1.5억을 치면 — jsdom 테스트(값 통째 주입)는 통과했지만 실제 타이핑에선 —억이 도착하기 전에 정수 필드의 라이브 포맷터가.을 먼저 제거해서15억으로 조용히 100배 잘못 읽히는 버그. 수정:1.→1.5)도 한글 초안과 동일한 무간섭 보호fromKorean결과를 필드의decimals예산으로 클램프 (단위 없이1.5에서 멈추고 blur →15가 아니라1)Verification / 검증
1.5억자당 입력 → 초안 유지 + 실시간 병기 "1억 5,000만" → blur150,000,000/3만5천→35,000확인머지 후 dispatch로 v0.3.0 릴리스합니다.