Skip to content

Commit 2b928ed

Browse files
committed
fix
1 parent 9ba0013 commit 2b928ed

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

Switch Traditional Chinese and Simplified Chinese/Switch Traditional Chinese and Simplified Chinese.user.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@
385385
'干':[
386386
'幹',
387387
['乾','口干','吃干','吐干','吮干','吸干','吹干','呷干','喉干','喝干','嘴干','太干','干井','干似','干冰','干冷','干化','干咳','干咽','干品','干哥','干嚎','干土','干坤','干妹','干姊','干姐','干姜','干娘','干爹','干爸','干妈','干季','干巴','干布','干干','干式','干弟','干性','干料','干旱','干杯','干果','干枝','干枯','干柴','干梅','干沙','干泥','干洗','干涸','干渴','干焦','干熬','干燥','干爽','干球','干疤','干瘦','干眼','干瞪','干硬','干窘','干笑','干等','干粉','干耗','干肉','干股','干脆','干花','干草','干菜','干薪','干衣','干裂','干透','干酪','干醋','干隆','干面','弄干','很干','抹干','抽干','揩干','擦干','晾干','朝干','未干','杯干','果干','桑干','榨干','水干','流干','海干','滴干','炒干','烘干','烤干','焙干','焦干','煨干','熨干','略干','碗干','粉干','耗干','肉干','舔干','菜干','蒸干','速干','干儿','干哑','干呕','干坛','干孙','干尸','干搁','干晒','干净','干涩','干涧','干湿','干热','干烧','干瘪','干瘾','干发','干粮','干结','干丝','干声','干叶','干号','干货','干阳','干饭','拧干','晒干','极干','泪干','沥干','烧干','烩干','发干','笋干','绞干','阴干','难干','风干','饮干','饼干','鱼干','唇干'],
388-
['干','干系','天干','干涉','干扰','干戈','相干','不干','干我什麽','干我事','干我的事','干你什麽','干你事','干你的事','干他什麽','干他事','干他的事','干她什麽','干她事','干她的事']
388+
['干','干系','天干','干涉','干扰','干戈','相干','不干','干我什','干我事','干我的事','干你什','干你事','干你的事','干他什','干他事','干他的事','干她什','干她事','干她的事']
389389
],
390390
'了':[
391391
'了',
@@ -867,11 +867,15 @@
867867
var curOther=others[k],fadd=curOther.indexOf(char),badd=curOther.length-1-fadd,x=0;
868868
var processChar=char;
869869
while(fadd-->0){
870-
if(char_f[x])processChar=char_f[x]+processChar;
870+
if (!char_f[x]) break;
871+
processChar=char_f[x]+processChar;
872+
x++;
871873
}
872874
x=0;
873875
while(badd-->0){
874-
if(char_b[x])processChar+=char_b[x];
876+
if (!char_b[x]) break;
877+
processChar+=char_b[x];
878+
x++;
875879
}
876880
if(processChar.indexOf(curOther) != -1){
877881
newChar=otherChar;
@@ -940,11 +944,15 @@
940944
var curOther=others[k],fadd=curOther.indexOf(char),badd=curOther.length-1-fadd,x=0;
941945
var processChar=char;
942946
while(fadd-->0){
943-
if(char_f[x])processChar=char_f[x]+processChar;
947+
if (!char_f[x]) break;
948+
processChar=char_f[x]+processChar;
949+
x++;
944950
}
945951
x=0;
946952
while(badd-->0){
947-
if(char_b[x])processChar+=char_b[x];
953+
if (!char_b[x]) break;
954+
processChar+=char_b[x];
955+
x++;
948956
}
949957
if(processChar.indexOf(curOther) != -1){
950958
newChar=otherChar;

Switch Traditional Chinese and Simplified Chinese/lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "switch-chinese",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "繁簡轉換,支援簡繁雙向轉換、智慧分詞、自訂詞庫、文字偵測及多種輸出格式,零依賴。 Lightweight Chinese converter library for conversion between Simplified and Traditional Chinese. 轻量级简繁体中文智能转换库,支持简繁双向转换、智能分词、自定义词库、文本检测及多种输出格式,零依赖。",
55
"main": "stcasc.lib.js",
66
"types": "stcasc.d.ts",

Switch Traditional Chinese and Simplified Chinese/lib/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# switch-chinese
22

3-
[Demo](https://tool.hoothin.com/chinese-converter)
3+
[Online Demo](https://tool.hoothin.com/chinese-converter)
44

55
[简体中文](#简体中文) | [繁體中文](#繁體中文) | [English](#english)
66

Switch Traditional Chinese and Simplified Chinese/lib/stcasc.lib.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ const sc2tc = {
329329
'干':[
330330
'幹',
331331
['乾','口干','吃干','吐干','吮干','吸干','吹干','呷干','喉干','喝干','嘴干','太干','干井','干似','干冰','干冷','干化','干咳','干咽','干品','干哥','干嚎','干土','干坤','干妹','干姊','干姐','干姜','干娘','干爹','干爸','干妈','干季','干巴','干布','干干','干式','干弟','干性','干料','干旱','干杯','干果','干枝','干枯','干柴','干梅','干沙','干泥','干洗','干涸','干渴','干焦','干熬','干燥','干爽','干球','干疤','干瘦','干眼','干瞪','干硬','干窘','干笑','干等','干粉','干耗','干肉','干股','干脆','干花','干草','干菜','干薪','干衣','干裂','干透','干酪','干醋','干隆','干面','弄干','很干','抹干','抽干','揩干','擦干','晾干','朝干','未干','杯干','果干','桑干','榨干','水干','流干','海干','滴干','炒干','烘干','烤干','焙干','焦干','煨干','熨干','略干','碗干','粉干','耗干','肉干','舔干','菜干','蒸干','速干','干儿','干哑','干呕','干坛','干孙','干尸','干搁','干晒','干净','干涩','干涧','干湿','干热','干烧','干瘪','干瘾','干发','干粮','干结','干丝','干声','干叶','干号','干货','干阳','干饭','拧干','晒干','极干','泪干','沥干','烧干','烩干','发干','笋干','绞干','阴干','难干','风干','饮干','饼干','鱼干','唇干'],
332-
['干','干系','天干','干涉','干扰','干戈','相干','干我什麽','干我事','干我的事','干你什麽','干你事','干你的事','干他什麽','干他事','干他的事','干她什麽','干她事','干她的事']
332+
['干','干系','天干','干涉','干扰','干戈','相干','干我什','干我事','干我的事','干你什','干你事','干你的事','干他什','干他事','干他的事','干她什','干她事','干她的事']
333333
],
334334
'了':[
335335
'了',
@@ -677,11 +677,15 @@ function traditionalizedString(orgStr, format) {
677677
var curOther = others[k], fadd = curOther.indexOf(char), badd = curOther.length - 1 - fadd, x = 0;
678678
var processChar = char;
679679
while (fadd-- > 0) {
680-
if (char_f[x]) processChar = char_f[x] + processChar;
680+
if (!char_f[x]) break;
681+
processChar = char_f[x] + processChar;
682+
x++;
681683
}
682684
x = 0;
683685
while (badd-- > 0) {
684-
if (char_b[x]) processChar += char_b[x];
686+
if (!char_b[x]) break;
687+
processChar += char_b[x];
688+
x++;
685689
}
686690
if (processChar.indexOf(curOther) != -1) {
687691
newChar = otherChar;
@@ -800,11 +804,15 @@ function simplizedString(orgStr, format) {
800804
var curOther = others[k], fadd = curOther.indexOf(char), badd = curOther.length - 1 - fadd, x = 0;
801805
var processChar = char;
802806
while (fadd-- > 0) {
803-
if (char_f[x]) processChar = char_f[x] + processChar;
807+
if (!char_f[x]) break;
808+
processChar = char_f[x] + processChar;
809+
x++;
804810
}
805811
x = 0;
806812
while (badd-- > 0) {
807-
if (char_b[x]) processChar += char_b[x];
813+
if (!char_b[x]) break;
814+
processChar += char_b[x];
815+
x++;
808816
}
809817
if (processChar.indexOf(curOther) != -1) {
810818
newChar = otherChar;
@@ -977,4 +985,4 @@ function stcasc(cache, custom, disableTerms) {
977985
return {simplized, traditionalized, detect, cache};
978986
}
979987

980-
export default stcasc;
988+
export default stcasc;

0 commit comments

Comments
 (0)