getpinyin

1.1.7 • Public • Published

根据汉字获取拼音

npm地址

https://www.npmjs.com/package/getpinyin

安装

npm install getpinyin --save

引用

import { getFirstPY, getFullPY } from 'getpinyin'
const { getFirstPY, getFullPY } = require('getpinyin')

使用

console.log(getFirstPY('国')) // g
console.log(getFirstPY('中国')) // zg
console.log(getFullPY('国')) // guo
console.log(getFullPY('中国')) // zhongguo

注意

没有对多音字进行处理

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i getpinyin

    Weekly Downloads

    26

    Version

    1.1.7

    License

    ISC

    Unpacked Size

    57.6 kB

    Total Files

    9

    Last publish

    Collaborators

    • niepeng