roma-otocomplete

0.0.2 • Public • Published

roma-otocomplete NPM version Build Status Dependency Status Coverage percentage

An autocomplete provider library for javascript.

Installation

$ npm install --save roma-otocomplete

Usage

var romaOtocomplete = require('roma-otocomplete');

see test/roma-otocomplete.js

Methods

romaOtocomplete.hiraganaToRomaji(kanaText)

Returns the romanized string for the given hiragana text.

RomaOtocomplete.hiraganaToRomaji("ふじさん") === "fujisan";  // true

romaOtocomplete.hiraganaToRomajiText(kanaText)

Returns the RomajiText object for the given hiragana text.

var romajiText = RomaOtocomplete.hiraganaToRomajiText("ぐらーふ・つぇっぺりん");
 
romajiText.toString() === "gura-futsuepperin");  // true

romaOtocomplete.testQuery(query, kanaText)

Returns RomajiText if all query characters got matches with them, otherwise null.

RomaOtocomplete.testQuery("choukai", "ちょうかい");  // RomajiText
RomaOtocomplete.testQuery("tyokai", "ちょうかい");  // RomajiText
RomaOtocomplete.testQuery("cho-kai", "ちょうかい");  // RomajiText
RomaOtocomplete.testQuery("tyookai", "ちょうかい");  // RomajiText
RomaOtocomplete.testQuery("maya", "ちょうかい");  // null

romaOtocomplete.getSuggestions(query, array, [romajiTextFunctor])

Get suggested texts for the given query.

var list = ["りゅうじょう", "りゅうほう", "しょうほう", "しょうかく", "たいほう"];
RomaOtocomplete.getSuggestions("ryu", list);

License

MIT © Spitice

Package Sidebar

Install

npm i roma-otocomplete

Weekly Downloads

4

Version

0.0.2

License

MIT

Last publish

Collaborators

  • seaofbirds