kyujitai
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/kyujitai package

1.3.0 • Public • Published

kyujitai.js

Build Status Greenkeeper badge

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 string
  • options: [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 string
  • options: [Object]
  • Returns: [String] Output string

Package Sidebar

Install

npm i kyujitai

Weekly Downloads

12

Version

1.3.0

License

MIT

Unpacked Size

65.4 kB

Total Files

10

Last publish

Collaborators

  • hakatashi