0.0.0 • Published 5 years ago

ehyu v0.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

ehyu.js

Hangul jamo replacer

var text = new ehyu.Gljas("안녕, 새로운 세상");
text.replace("ㅔ", "ㅐ", {lock: true})
    .replace("ㅐ", "ㅔ");
console.log(text.content);
// 안녕, 세로운 새상

Installation

NPM

npm install ehyu
const ehyu = require("ehyu");

CDN

<script src="https://unpkg.com/browse/ehyu/dist/ehyu.umd.js"></script>

How To Use

var text = new ehyu.Gljas("바꿀 글");

Simple Replace

text.replace("ㄱ", "ㄴ");
//바꿀 늘

Multiple Replace

var text = new ehyu.Gljas("네모네모 멍뭉이의 저주");

text.replace("ㅇ", "ㅁ")
    .replace("ㅎ", "ㅍ");
// or
text.replace(["ㅇ", "ㅎ"], ["ㅁ", "ㅍ"]);
// or
text.replace("ㅇㅎ", "ㅁㅍ");

Option

text.replace("ㄱ", "ㄴ",{
    target: "coda", 
    // "onset"(초성), "nucleus"(중성), "coda"(종성)
    // 설정 시 해당하는 자모만 변경
    lock: true 
    // 기본값: false
    // true로 설정 시 변경된 자모는 다시 바뀌지 않음
});