ipa-hangul 1.3.1 → 1.3.2

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
@@ -190,8 +190,10 @@ var VOWEL_TO_JUNGSEONG = {
190
190
  "w\u025B": [JUNGSEONG.WE],
191
191
  "we": [JUNGSEONG.WE],
192
192
  "w\xE6": [JUNGSEONG.WAE],
193
+ "wa\u026A": [JUNGSEONG.WA, JUNGSEONG.I],
193
194
  "ju\u02D0": [JUNGSEONG.YU],
194
195
  "ju": [JUNGSEONG.YU],
196
+ "j\u028A": [JUNGSEONG.YU],
195
197
  "j\u0259": [JUNGSEONG.YEO],
196
198
  "j\u025B": [JUNGSEONG.YE],
197
199
  "je": [JUNGSEONG.YE],
@@ -295,6 +297,27 @@ function getTrailingConsonants(text, preferOnset = false) {
295
297
  }
296
298
  }
297
299
  const lastOne = allTrailing[allTrailing.length - 1];
300
+ if ((lastOne === "j" || lastOne === "w") && allTrailing.length >= 2) {
301
+ const beforeSemiVowel = allTrailing.substring(0, allTrailing.length - 1);
302
+ if (beforeSemiVowel.length >= 2) {
303
+ const lastTwoBeforeSemi = beforeSemiVowel.substring(beforeSemiVowel.length - 2);
304
+ if (CONSONANT_TO_CHOSEONG[lastTwoBeforeSemi]) {
305
+ return {
306
+ before: beforeConsonants + beforeSemiVowel.substring(0, beforeSemiVowel.length - 2),
307
+ trailing: lastTwoBeforeSemi + lastOne
308
+ };
309
+ }
310
+ }
311
+ if (beforeSemiVowel.length >= 1) {
312
+ const oneBeforeSemi = beforeSemiVowel[beforeSemiVowel.length - 1];
313
+ if (CONSONANT_TO_CHOSEONG[oneBeforeSemi]) {
314
+ return {
315
+ before: beforeConsonants + beforeSemiVowel.substring(0, beforeSemiVowel.length - 1),
316
+ trailing: oneBeforeSemi + lastOne
317
+ };
318
+ }
319
+ }
320
+ }
298
321
  if (CONSONANT_TO_CHOSEONG[lastOne] || CONSONANT_TO_JAMO[lastOne]) {
299
322
  return {
300
323
  before: beforeConsonants + allTrailing.substring(0, allTrailing.length - 1),
package/dist/index.mjs CHANGED
@@ -166,8 +166,10 @@ var VOWEL_TO_JUNGSEONG = {
166
166
  "w\u025B": [JUNGSEONG.WE],
167
167
  "we": [JUNGSEONG.WE],
168
168
  "w\xE6": [JUNGSEONG.WAE],
169
+ "wa\u026A": [JUNGSEONG.WA, JUNGSEONG.I],
169
170
  "ju\u02D0": [JUNGSEONG.YU],
170
171
  "ju": [JUNGSEONG.YU],
172
+ "j\u028A": [JUNGSEONG.YU],
171
173
  "j\u0259": [JUNGSEONG.YEO],
172
174
  "j\u025B": [JUNGSEONG.YE],
173
175
  "je": [JUNGSEONG.YE],
@@ -271,6 +273,27 @@ function getTrailingConsonants(text, preferOnset = false) {
271
273
  }
272
274
  }
273
275
  const lastOne = allTrailing[allTrailing.length - 1];
276
+ if ((lastOne === "j" || lastOne === "w") && allTrailing.length >= 2) {
277
+ const beforeSemiVowel = allTrailing.substring(0, allTrailing.length - 1);
278
+ if (beforeSemiVowel.length >= 2) {
279
+ const lastTwoBeforeSemi = beforeSemiVowel.substring(beforeSemiVowel.length - 2);
280
+ if (CONSONANT_TO_CHOSEONG[lastTwoBeforeSemi]) {
281
+ return {
282
+ before: beforeConsonants + beforeSemiVowel.substring(0, beforeSemiVowel.length - 2),
283
+ trailing: lastTwoBeforeSemi + lastOne
284
+ };
285
+ }
286
+ }
287
+ if (beforeSemiVowel.length >= 1) {
288
+ const oneBeforeSemi = beforeSemiVowel[beforeSemiVowel.length - 1];
289
+ if (CONSONANT_TO_CHOSEONG[oneBeforeSemi]) {
290
+ return {
291
+ before: beforeConsonants + beforeSemiVowel.substring(0, beforeSemiVowel.length - 1),
292
+ trailing: oneBeforeSemi + lastOne
293
+ };
294
+ }
295
+ }
296
+ }
274
297
  if (CONSONANT_TO_CHOSEONG[lastOne] || CONSONANT_TO_JAMO[lastOne]) {
275
298
  return {
276
299
  before: beforeConsonants + allTrailing.substring(0, allTrailing.length - 1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ipa-hangul",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Convert IPA (International Phonetic Alphabet) pronunciation to Korean Hangul",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",