fix: 增加 xuan 的韵母

This commit is contained in:
zh-lx
2022-11-16 22:18:28 +08:00
parent 07e23aa7d8
commit a7681389fc
5 changed files with 38 additions and 3 deletions

View File

@@ -1,7 +1,9 @@
rollup.config.js
docs
coverage
dist/pinyin-pro.js
.github
.husky
handle-data
handle-data
lib
data
test

View File

@@ -27,6 +27,11 @@ export const InitialList = [
export const SpecialInitialList = ['j', 'q', 'x'];
export const SpecialFinalList = [
'uān',
'uán',
'uǎn',
'uàn',
'uan',
'ūn',
'ún',
'ǔn',
@@ -40,6 +45,11 @@ export const SpecialFinalList = [
];
export const SpecialFinalMap = {
uān: 'üān',
uán: 'üán',
uǎn: 'üǎn',
uàn: 'üàn',
uan: 'üan',
ūn: 'ǖn',
ún: 'ǘn',
ǔn: 'ǚn',
@@ -51,3 +61,5 @@ export const SpecialFinalMap = {
ù: 'ǜ',
u: 'ü',
};
export const doubleFinal = [];

View File

@@ -25,8 +25,19 @@ interface BasicOptions {
* @value final返回韵母
* @value num返回音调对应的数字
* @value first返回首字母
* @value finalHead返回韵头介音
* @value finalBody返回韵腹
* @value finalTail返回韵尾
*/
pattern?: 'pinyin' | 'initial' | 'final' | 'num' | 'first';
pattern?:
| 'pinyin'
| 'initial'
| 'final'
| 'num'
| 'first'
| 'finalHead'
| 'finalBody'
| 'finalTail';
/**
* @description 是否返回单个汉字的所有多音,仅针对输入的 word 为单个汉字生效
* @value false返回最常用的一个拼音 (默认值)

View File

@@ -19,6 +19,10 @@
"type": "git",
"url": "git+https://github.com/zh-lx/pinyin-pro.git"
},
"files": [
"dist",
"types"
],
"keywords": [
"拼音",
"pinyin",

View File

@@ -293,6 +293,7 @@ describe('surname', () => {
describe('pinyinFn', () => {
it('not string type', () => {
// @ts-ignore
const result = pinyin(2222);
expect(result).to.be.equal(2222);
});
@@ -576,5 +577,10 @@ describe('customConfig', () => {
pattern: 'final',
});
expect(result1).to.deep.equal('ǘ');
const result2 = pinyin('选', {
pattern: 'final',
});
expect(result1).to.deep.equal('üǎn');
});
});