forked from Kaifuny/pinyin4js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (28 loc) · 1.15 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
var PinyinHelper = require('./lib/PinyinHelper');
var ChineseHelper = require('./lib/ChineseHelper');
var PinyinFormat = require('./lib/PinyinHelper');
var pinyin4js = {
WITH_TONE_MARK :"WITH_TONE_MARK", //带声调
WITHOUT_TONE :"WITHOUT_TONE", //不带声调
WITH_TONE_NUMBER :"WITH_TONE_NUMBER", //数字代表声调
FIRST_LETTER :"FIRST_LETTER", //首字母风格
convertToPinyinString: function(str, separator, format) {
return PinyinHelper.PinyinHelper.convertToPinyinString(str, separator, format);
},
convertToSimplifiedChinese: function(str) {
return ChineseHelper.ChineseHelper.convertToSimplifiedChinese(str);
},
convertToTraditionalChinese: function(str) {
return ChineseHelper.ChineseHelper.convertToTraditionalChinese(str);
},
getShortPinyin: function(str) {
return PinyinHelper.PinyinHelper.getShortPinyin(str);
}
}
;(function(){
global.PinyinHelper = PinyinHelper.PinyinHelper;
global.ChineseHelper = ChineseHelper.ChineseHelper;
global.PinyinFormat = PinyinFormat.PinyinFormat;
})();
module.exports = pinyin4js