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

1.0.0 • Public • Published

Pinyin Tone Converter

A simple Javascript plugin to convert pinyin with numbers to tone marks. This plugin is based on the Quizlet Pinyin Converter

Works in node and in the browser. No external dependencies.

Installation

npm install pinyin-tone-converter

Usage

import convertPinyinTones from 'pinyin-tone-converter';
 
convertPinyinTones('ni3hao3');
// returns 'nǐhǎo'
 
convertPinyinTones('san1ren2xing2bi4you3wo3shi1');
// returns "sānrénxíngbìyǒuwǒshī"
 
// ü can be typed by using v
convertPinyinTones('lv4');
// returns "lǜ"
 
// works with uppercase chars too
convertPinyinTones('WO3 HEN3 XI3HUAN QUIZLET!');
// returns "WǑ HĚN XǏHUAN QUIZLET!"

License

pinyin-tone-converter is released under a MIT License

Contributing

Contributions are welcome! These steps will guide you through contributing to this project:

Make and commit your changes. Make sure the commands yarn run build and yarn run test:prod are working.

Finally send a GitHub Pull Request with a clear list of what you've done. Make sure all of your commits are atomic (one feature per commit). Please add tests for any features that you add or change.

Enjoy!

Readme

Keywords

none

Package Sidebar

Install

npm i pinyin-tone-converter

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

38.5 kB

Total Files

10

Last publish

Collaborators

  • chanind