半角全角変換ライブラリ test
→
import { moji } from "./index.mjs"; const toHalfWidth = function (full) { return moji(full).convert('ZE', 'HE').convert('ZS', 'HS').convert('ZK', 'HK').toString(); } const toFullWidth = function (half) { return moji(half).convert('HE', 'ZE').convert('HS', 'ZS').convert('HK', 'ZK').toString(); } src.onchange = () => { dst.value = toHalfWidth(src.value); }
src on GitHub