remove "fragment" from jp.convertReading variables

This commit is contained in:
siikamiika 2020-04-13 22:59:56 +03:00
parent f93dc85710
commit 6cc87ec975
2 changed files with 11 additions and 11 deletions

View File

@ -124,25 +124,25 @@
return wanakana.toRomaji(text);
}
function convertReading(expressionFragment, readingFragment, readingMode) {
function convertReading(expression, reading, readingMode) {
switch (readingMode) {
case 'hiragana':
return convertKatakanaToHiragana(readingFragment);
return convertKatakanaToHiragana(reading);
case 'katakana':
return convertHiraganaToKatakana(readingFragment);
return convertHiraganaToKatakana(reading);
case 'romaji':
if (readingFragment) {
return convertToRomaji(readingFragment);
if (reading) {
return convertToRomaji(reading);
} else {
if (isStringEntirelyKana(expressionFragment)) {
return convertToRomaji(expressionFragment);
if (isStringEntirelyKana(expression)) {
return convertToRomaji(expression);
}
}
return readingFragment;
return reading;
case 'none':
return '';
default:
return readingFragment;
return reading;
}
}

View File

@ -208,8 +208,8 @@ function testConvertReading() {
[['有り難う', '', 'default'], '']
];
for (const [[expressionFragment, readingFragment, readingMode], expected] of data) {
assert.strictEqual(jp.convertReading(expressionFragment, readingFragment, readingMode), expected);
for (const [[expression, reading, readingMode], expected] of data) {
assert.strictEqual(jp.convertReading(expression, reading, readingMode), expected);
}
}