@wohui/pinyin
TypeScript icon, indicating that this package has built-in type declarations

1.6.0 • Public • Published

pinyin helper library on top of the great hanzi library

Usage:

import { start, pinyin, tolerant, chinese } from '@wohui/pinyin'

start()
console.log(pinyin('汪峰老师!我是从小听着您的歌长大的~', 'num'))
//-> Wang1 feng1 lao3 shi1 ! wo3 shi4 cong2 xiao3 ting1 zhao1 nin2 de5 ge1 zhang3 da4 de5 ~

console.log(pinyin('汪峰老师!我是从小听着您的歌长大的~', 'tone'))
//-> Wāng fēng lǎo shī ! wǒ shì cóng xiǎo tīng zhāo nín de gē zhǎng dà de ~

console.log(tolerant('中国人行', 'zhong1 guo2 ren2 xing2'))
//-> true

console.log(tolerant('中国人行', 'zhong1 guo2 ren2 hang2'))
//-> true
  
console.log(chinese('mei3 guo2 fu4 gong1 you2 xing2'))
//-> 美国复公由行

Readme

Keywords

none

Package Sidebar

Install

npm i @wohui/pinyin

Weekly Downloads

0

Version

1.6.0

License

MIT

Unpacked Size

65.6 kB

Total Files

25

Last publish

Collaborators

  • stevenbelous
  • liuxiaotian
  • b051