toss / es-hangul

A modern JavaScript library for handling Hangul characters.
https://es-hangul.slash.page/
MIT License
1.34k stars 95 forks source link

feat: 한글 자모음을 인자로 입력받아 한글 문자로 합성하는 함수 추가 #53

Closed evan-moon closed 6 months ago

evan-moon commented 6 months ago

Overview

https://github.com/toss/es-hangul/issues/18 에서 이슈레이징된 aseemble 함수를 구현하기 위해 한글 문자를 합성하는 함수를 추가합니다.

combineHangulCharacter

초성, 중성, 종성을 인자로 받아 하나의 한글 문자를 생성합니다. 만약 잘못된 값을 입력받았다면 "Invalid hangul character" 에러를 throw 합니다.

combineHangulCharacter('ㄱ', 'ㅏ', 'ㅂㅅ') // '값'

curriedCombineHangulCharacter

combineHangulCharacter 함수의 커링된 버전입니다. https://github.com/toss/es-hangul/issues/18 에서 이슈레이징된, 조건에 따라 순차적으로 문자를 합성해나가야하는 함수를 구현할 때 필요합니다.

const combineMiddleHangulCharacter = curriedCombineHangulCharacter('ㄱ')
const combineLastHangulCharacter = combineMiddleHangulCharacter('ㅏ')

combineLastHangulCharacter('ㄱ') // '각'

combineVowels

두 개의 단모음을 인자로 받아 겹모음을 생성합니다. 만약 올바르지 않은 단모음을 입력받았다면 Join하여 반환합니다.

combineVowels('ㅗ', 'ㅏ') // 'ㅘ'

PR Checklist

  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.
changeset-bot[bot] commented 6 months ago

🦋 Changeset detected

Latest commit: 1e2d292ac53209fa0941f6a7ff0510617a82557f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

netlify[bot] commented 6 months ago

Deploy Preview for es-hangul ready!

Name Link
Latest commit 1e2d292ac53209fa0941f6a7ff0510617a82557f
Latest deploy log https://app.netlify.com/sites/es-hangul/deploys/661f27697973e40008f3362d
Deploy Preview https://deploy-preview-53--es-hangul.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.