word-pinyin
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

word-pinyin

Build Status npm size download

Node端汉字转拼音库, 针对小程序设计, 不支持多音字

安装

yarn add word-pinyin

例子

import PinYin from "word-pinyin";
 
PinYin.getPinyin("你好骚啊") // ni hao sao a
PinYin.getFirstLetter("你好骚啊") // NHSA

方法

getPinyin(chinese: string, splitter: string = ' ') 获取汉字的拼音

  • cinese: 汉字
  • splitter: 字与字之间的分隔符

getFirstLetter(str: string) 获取汉字的拼音首字母

  • str: 汉字

感谢

Package Sidebar

Install

npm i word-pinyin

Weekly Downloads

18

Version

0.1.8

License

ISC

Unpacked Size

137 kB

Total Files

17

Last publish

Collaborators

  • zhylmzr