installation
npm install pinyin-engine --save
API
new PinyinEngine(list, keys)
Establish pinyin index.
parameter:
- list
{[string]|[Object]}
is indexed goal - keys
{[string]}
optional. If the list isObject
here used to set the key to be indexed
.query(keyword)
Query data matching alphabet.
parameter:
- keyword
{string}
spelling or keyword
return:
{[string]|{Object}}
Traditional Chinese version
It contains Simplified Chinese and Traditional Chinese.
const PinyinEngine =
Examples of use
List item as a string:
const PinyinEngine =
// Create Data Index
const pinyinEngine =
'Tsinghua University '
'Peking '
'Center beauty salon '
// Inquire
pinyinEngine
List item as an object:
const PinyinEngine =
// Create Data Index
const pinyinEngine =
// Inquire
pinyinEngine