Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tenji with all npm packages installed. Try it out:

var tenji = require("tenji")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tenji v1.0.3

Converts Japanese text and 点字.

tenji

Converts Japanese text to 点字 (Braille).

Installation

$ npm install tenji

Usage

const tenji = require('tenji');

tenji.toTenji('こんにちわ'); // '⠪⠴⠇⠗⠄'

tenji.fromTenji('⠱⠜⠒⠅⠑'); // 'さよーなら'

//Braille Kanji is supported!
tenji.toTenji('漢点字', {kanji: true}); // '⢱⢚⠷⣸⠓⢜'

tenji.fromTenji('⠱⣎⣁⠾⡤⢲⢂⠆⡲⠦⠤⡄', {kanji: true}); //'東京スカイツリー'

tenji.toTenji(text [, options])

Converts Japanese text to Tenji.

options

  • preserveSpaces (boolean): Preserves any space characters in text. Otherwise all spaces are converted into U+2800 (⠀). Defaults to false.
  • lowerDots (boolean): Use lower 6 dots instead of upper 6 dots. Defaults to false. This option is force to be true if kanji option is enabled.
  • kanji (boolean): Enables 漢点字 support.
  • noNormalize (boolean): Prevents text from being text.normalize('NFKC').

tenji.fromTenji(text [, options])

Converts Tenji to Japanese Text.

options

  • space (string): Space character generated by U+2800 (⠀). Defaults to U+0020 ( ).
  • kanji (boolean): Enables 漢点字 support.

License

MIT

Changelog

  • v1.0.3: Fix the bug that "⠰" which is used as 読点 also made next hiragana 濁音.
  • v1.0.2: Can now convert some more 記号s.
  • v1.0.1: Bug fix
  • v1.0.0

References

  • http://www.yoihari.net/tenji/kantenji
  • http://www.yoihari.net/tenji/tkigo.htm
  • http://www.braille.jp/_files/00006828/kaiteian.pdf

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free