Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
pinyin-pro
Advanced tools
专业的、功能最丰富的中文汉字与拼音的转化库
npm install pinyin-pro
const { pinyin } = require('pinyin-pro')
同时支持浏览器和 node 环境
pinyin(word, options)
接收两个参数
const { pinyin } = require('pinyin-pro')
// 获取带音调拼音
pinyin('汉语拼音') // 'hàn yǔ pīn yīn'
// 将声调转换为数字后缀
pinyin('汉语拼音', { pattern: 'pinyinNum' }) // 'han4 yu3 pin1 yin1'
// 获取声母
pinyin('汉语拼音', { pattern: 'initial' }) // 'h y p y'
// 获取韵母
pinyin('汉语拼音', { pattern: 'final' }) // 'àn ǔ īn īn'
// 获取音调
pinyin('汉语拼音', { pattern: 'num' }) // '4 3 1 1'
pinyin('汉语拼音', { tone: false }) // 'han yu pin yin'
pinyin('汉语拼音', { type: 'array' }) // [ 'hàn', 'yǔ', 'pīn', 'yīn' ]
pinyin('好', { multitone: true }) // 'hǎo hào'
pinyin('汉语拼音', { type: 'array', pattern: 'pinyinNum' }) // [ 'han4', 'yu3', 'pin1', 'yin1' ]
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
pattern | 输出的结果的信息(带音调全拼/音调为数字后缀的全拼/声母/韵母/音调) | string | pinyin/pinyinNum/initial/final/num | pinyin |
tone | 是否开启音调(为 true 时会覆盖 pattern 中的音调) | boolean | true/false | true |
type | 输出结果类型(字符串/数组) | string | string/array | string |
multitone | 输出多音字全部拼音(仅在词 word 长度为 1 时生效) | boolean | true/false | false |
有问题或者功能需求支持欢迎提 issue,紧急可联系微信:zhoulx1688888
FAQs
The npm package pinyin-pro receives a total of 20,511 weekly downloads. As such, pinyin-pro popularity was classified as popular.
We found that pinyin-pro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.