kyujitai
v1.3.0
Published
Utility collections for making Japanese text old-fashioned.
Downloads
51
Maintainers
Readme
kyujitai.js
Utility collections for making Japanese text old-fashioned.
install
npm install kyujitai
Use
const Kyujitai = require('kyujitai');
const kyujitai = new Kyujitai((error) => {
kyujitai.encode('旧字体'); //=> '舊字體'
});
Usage
new Kyujitai([options], [callback])
Constructor.
options
: [Object]callback
: [Function(error)] Called when construction completed.error
: [Error] Supplied if construction failed.
kyujitai.encode(string, [options])
Encode string from shinjitai to kyujitai.
string
: [String] Input stringoptions
: [Object]options.IVD
: [Boolean]true
if you want to allow IVS for the encoded string. Default is false.
- Returns: [String] Output string
kyujitai.encode('旧字体'); //=> '舊字體'
kyujitai.encode('画期的図画'); //=> '劃期的圖畫'
kyujitai.encode('弁明'); //=> '辯明'
kyujitai.encode('弁償'); //=> '辨償'
kyujitai.encode('花弁'); //=> '花瓣'
kyujitai.encode('弁髪'); //=> '辮髮'
kyujitai.decode(string, [options])
Decode string from kyujitai to shinjitai.
string
: [String] Input stringoptions
: [Object]- Returns: [String] Output string