Skip to content

Commit d24397c

Browse files
committed
wrote some readme stuff, created js file
1 parent 88e5e0e commit d24397c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2017 Kevin Yang
3+
Copyright (c) 2017 Kevin K. Yang
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
# pinyinify
2-
Convert pinyin tone numbers to Unicode tone marks.
2+
A simple JavaScript function for converting pinyin containing tone numbers (`pin4yin1`) to pinyin using standard Unicode tone marks (<code>pi&#768;nyi&#772;n</code>).
3+
4+
## Usage
5+
The function `pinyinify()` takes a string parameter, which can be one of the following:
6+
7+
+ A single character, which must be one of: `a`, `e`, `i`, `o`, `u`, or <code>&#252;</code>, followed by a tone mark. `v` is an acceptable substitute for <code>&#252;</code>.
8+
+ A pinyin word or phrase using tone numbers. Examples: `mao1`, `chi1fan4`, `wo3men5`. For simplicity's sake, the function will process most words with tone numbers, including ones that may not be valid pinyin.
9+
+ A string containing both pinyin words and non-pinyin words, characters, or symbols. Example: `My Chinese name is yang2kai3wen2.` **Be careful:** any word that resembles the structure of pinyin (has a number at the end of it, for example) may be given tone marks. Therefore, it is recommended that you avoid this option if possible.
10+
11+
If you pass a string that meets one of the requirements above, the function will return a string with the tone numbers converted to tone marks. Otherwise, it will return an unchanged string.

pinyinify.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
var pinyinify = function(str) {
3+
4+
}

0 commit comments

Comments
 (0)