@konomi-app/kintone-utilities 6.2.0 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- // src/character-hebon.ts
2
- var hebonMap = {
1
+ // src/character-ime-roman.ts
2
+ var imeRomanMap = {
3
3
  \u3042: "A",
4
4
  \u3044: "I",
5
5
  \u3046: "U",
@@ -11,13 +11,13 @@ var hebonMap = {
11
11
  \u3051: "KE",
12
12
  \u3053: "KO",
13
13
  \u3055: "SA",
14
- \u3057: "SHI",
14
+ \u3057: "SI",
15
15
  \u3059: "SU",
16
16
  \u305B: "SE",
17
17
  \u305D: "SO",
18
18
  \u305F: "TA",
19
- \u3061: "CHI",
20
- \u3064: "TSU",
19
+ \u3061: "TI",
20
+ \u3064: "TU",
21
21
  \u3066: "TE",
22
22
  \u3068: "TO",
23
23
  \u306A: "NA",
@@ -27,7 +27,7 @@ var hebonMap = {
27
27
  \u306E: "NO",
28
28
  \u306F: "HA",
29
29
  \u3072: "HI",
30
- \u3075: "FU",
30
+ \u3075: "HU",
31
31
  \u3078: "HE",
32
32
  \u307B: "HO",
33
33
  \u307E: "MA",
@@ -44,27 +44,23 @@ var hebonMap = {
44
44
  \u308C: "RE",
45
45
  \u308D: "RO",
46
46
  \u308F: "WA",
47
- \u3090: "I",
48
- \u3091: "E",
49
- \u3092: "O",
50
- \u3041: "A",
51
- \u3043: "I",
52
- \u3045: "U",
53
- \u3047: "E",
54
- \u3049: "O",
47
+ \u3090: "WI",
48
+ \u3091: "WE",
49
+ \u3092: "WO",
50
+ \u3093: "NN",
55
51
  \u304C: "GA",
56
52
  \u304E: "GI",
57
53
  \u3050: "GU",
58
54
  \u3052: "GE",
59
55
  \u3054: "GO",
60
56
  \u3056: "ZA",
61
- \u3058: "JI",
57
+ \u3058: "ZI",
62
58
  \u305A: "ZU",
63
59
  \u305C: "ZE",
64
60
  \u305E: "ZO",
65
61
  \u3060: "DA",
66
- \u3062: "JI",
67
- \u3065: "ZU",
62
+ \u3062: "DI",
63
+ \u3065: "DU",
68
64
  \u3067: "DE",
69
65
  \u3069: "DO",
70
66
  \u3070: "BA",
@@ -77,106 +73,25 @@ var hebonMap = {
77
73
  \u3077: "PU",
78
74
  \u307A: "PE",
79
75
  \u307D: "PO",
80
- \u304D\u3083: "KYA",
81
- \u304D\u3085: "KYU",
82
- \u304D\u3087: "KYO",
83
- \u3057\u3083: "SHA",
84
- \u3057\u3085: "SHU",
85
- \u3057\u3087: "SHO",
86
- \u3061\u3083: "CHA",
87
- \u3061\u3085: "CHU",
88
- \u3061\u3087: "CHO",
89
- \u3061\u3047: "CHE",
90
- \u306B\u3083: "NYA",
91
- \u306B\u3085: "NYU",
92
- \u306B\u3087: "NYO",
93
- \u3072\u3083: "HYA",
94
- \u3072\u3085: "HYU",
95
- \u3072\u3087: "HYO",
96
- \u307F\u3083: "MYA",
97
- \u307F\u3085: "MYU",
98
- \u307F\u3087: "MYO",
99
- \u308A\u3083: "RYA",
100
- \u308A\u3085: "RYU",
101
- \u308A\u3087: "RYO",
102
- \u304E\u3083: "GYA",
103
- \u304E\u3085: "GYU",
104
- \u304E\u3087: "GYO",
105
- \u3058\u3083: "JA",
106
- \u3058\u3085: "JU",
107
- \u3058\u3087: "JO",
108
- \u3073\u3083: "BYA",
109
- \u3073\u3085: "BYU",
110
- \u3073\u3087: "BYO",
111
- \u3074\u3083: "PYA",
112
- \u3074\u3085: "PYU",
113
- \u3074\u3087: "PYO"
114
- };
115
- var aaSet = {
116
- AA: true,
117
- EE: true,
118
- II: false,
119
- // I は連続しても省略しない
120
- OO: true,
121
- OU: true,
122
- UU: true
123
- };
124
- var getHebon = (s, index) => {
125
- let h = null;
126
- let c = null;
127
- if (index + 1 < s.length) {
128
- c = s.substring(index, index + 2);
129
- h = hebonMap[c];
130
- }
131
- if (!h && index < s.length) {
132
- c = s.substring(index, index + 1);
133
- h = hebonMap[c];
134
- }
135
- return { c: c ?? "", h: h ?? null };
136
- };
137
- function toHebon(s) {
138
- let hebon = "";
139
- let lastHebon = "";
140
- let i = 0;
141
- while (i < s.length) {
142
- const hr = getHebon(s, i);
143
- if (hr.c === "\u3063") {
144
- const nextHr = getHebon(s, i + 1);
145
- if (nextHr.h !== null) {
146
- if (nextHr.h.startsWith("CH")) {
147
- hr.h = "T";
148
- } else {
149
- hr.h = nextHr.h.substring(0, 1);
150
- }
151
- }
152
- } else if (hr.c === "\u3093") {
153
- const nextHr = getHebon(s, i + 1);
154
- if (nextHr.h !== null && "BMP".indexOf(nextHr.h.charAt(0)) !== -1) {
155
- hr.h = "M";
156
- } else {
157
- hr.h = "N";
158
- }
159
- } else if (hr.c === "\u30FC") {
160
- hr.h = "";
161
- }
162
- if (hr.h !== null) {
163
- if (lastHebon !== null) {
164
- let htest = lastHebon + hr.h;
165
- if (htest.length > 2) {
166
- htest = htest.substring(htest.length - 2);
167
- }
168
- if (aaSet[htest]) {
169
- hr.h = "";
170
- }
171
- }
172
- hebon += hr.h;
173
- } else {
174
- hebon += hr.c;
175
- }
176
- lastHebon = hr.h;
177
- i += hr.c.length;
76
+ \u3094: "VU",
77
+ \u3041: "XA",
78
+ \u3043: "XI",
79
+ \u3045: "XU",
80
+ \u3047: "XE",
81
+ \u3049: "XO",
82
+ \u3063: "XTU",
83
+ \u3083: "XYA",
84
+ \u3085: "XYU",
85
+ \u3087: "XYO",
86
+ \u30FC: ""
87
+ };
88
+ function toIMERoman(s) {
89
+ let result = "";
90
+ for (let i = 0; i < s.length; i++) {
91
+ const mapped = imeRomanMap[s[i]];
92
+ result += mapped !== void 0 ? mapped : s[i];
178
93
  }
179
- return hebon;
94
+ return result;
180
95
  }
181
96
 
182
97
  // src/character-width-conversion.ts
@@ -304,7 +219,7 @@ var getYuruChara = (target, options) => {
304
219
  converted = convertKatakanaToHiragana(converted);
305
220
  }
306
221
  if (!isHebonSensitive) {
307
- converted = toHebon(converted);
222
+ converted = toIMERoman(converted);
308
223
  }
309
224
  if (!isCaseSensitive) {
310
225
  converted = converted.toLowerCase();