pinyin-so.test

⚠️⚠️⚠️ 目前为非稳定版本

Usage no npm install needed!

<script type="module">
  import pinyinSoTest from 'https://cdn.skypack.dev/pinyin-so.test';
</script>

README

pinyin-so

⚠️⚠️⚠️ 目前为非稳定版本

NPM version

拼音搜索方案,支持 全拼/简拼/同音字 等。

Demo

demo

Usage

import PinyinSo from 'pinyin-so';

/**
 * @name    PinyinSo.so
 * @param   {String}    targetStr   待搜索文本
 * @param   {String}    keyword     搜索关键词
 * @returns {Boolean | Array}       失败结果 或者 结果索引
 */
const res = PinyinSo.so(`${targetStr}`, `${keyword}`);
if(res) {
  const [start, end] = res;
} else {
  console.log('No matching results.');
}

待办

  • 优化代码
  • 发新版

参考

xmflswood/pinyin-match