@tmilar/furigana-helper
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/tmilar__furigana-helper package

0.1.0 • Public • Published

Lib to support Kanji-only furigana string extractions. Created as a collaboration for Furigana Chrome Extension.

Usage

Install lib:

npm install @tmilar/furigana-helper

Then, import it

const { combineOriginalAndKana } = require("@tmilar/furigana-helper")

const combined = combineOriginalAndKana("送り仮名", "おくりがな")
// =>  [
//       ["送", "おく"],
//       ["り", "り"],
//       ["仮名", "がな"],
//     ]

API

combineOriginalAndKana(original, kana)

Given an input of an arbitrary japanese string, and the corresponding -kana string, return an array of the combinations of original kanji + kana, and the original kana kept unmodified.

For example:

const original = "送り仮名"
const kana = "おくりがな"

combineOriginalAndKana(original, kana)
// =>  [
//       ["送", "おく"],
//       ["り", "り"],
//       ["仮名", "がな"],
//     ]

Katakana input is not modified:

const original = "ケーソン工法"
const kana = "けえそん こうほう"

combineOriginalAndKana(original, kana)
// =>  [
//       ["ケーソン", "ケーソン"],
//       ["工法", "こうほう"],
//     ]

Test

Clone & install locally:

git clone git@github.com:tmilar/furigana-helper.git && cd furigana-helper
npm install

Run tests:

npm test

License

MIT

Package Sidebar

Install

npm i @tmilar/furigana-helper

Weekly Downloads

8

Version

0.1.0

License

MIT

Unpacked Size

9.41 kB

Total Files

5

Last publish

Collaborators

  • tmilar