Created
January 18, 2019 09:59
-
-
Save yjb94/bdea776f487b57094710fa375959e329 to your computer and use it in GitHub Desktop.
이/가 을/를 은/는 과/와 이여/여 으로/로 조사 포함 문자열 반환 코드
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
/** | |
* @crated JongBae Yun <[email protected]> | |
* @license MIT | |
*/ | |
import * as hangul from 'hangul-js'; | |
export const josa = (function() { | |
return { | |
iGa: (input) => { | |
return hangul.endsWithConsonant(input) ? `${input}이` : `${input}가`; | |
}, | |
eulReul: (input) => { | |
return hangul.endsWithConsonant(input) ? `${input}을` : `${input}를`; | |
}, | |
eunNeun: (input) => { | |
return hangul.endsWithConsonant(input) ? `${input}은` : `${input}는`; | |
}, | |
gwaWa: (input) => { | |
return hangul.endsWithConsonant(input) ? `${input}과` : `${input}와`; | |
}, | |
iyeoYeo: (input) => { | |
return hangul.endsWithConsonant(input) ? `${input}이여` : `${input}여`; | |
}, | |
roEuro: (input) => { | |
const j = hangul.endsWithConsonant(input); | |
const r = hangul.disassemble(input).pop() !== 'ㄹ' | |
return j && r ? `${input}으로` : `${input}로`; | |
}, | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment