taraskevizer 1.4.0 → 1.4.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.cjs CHANGED
@@ -2190,7 +2190,7 @@ function restoreCase(text, orig) {
2190
2190
  continue;
2191
2191
  if (word === "зь") {
2192
2192
  text[i] = isUpperCase(orig[i + 1]) ? "ЗЬ" : "Зь";
2193
- } else if (isUpperCase(oWord[oWord.length - 1])) {
2193
+ } else if (isUpperCase(getLastLetter(oWord))) {
2194
2194
  text[i] = word.toUpperCase();
2195
2195
  } else {
2196
2196
  text[i] = word[0] === "(" ? word.replace(
@@ -2201,6 +2201,11 @@ function restoreCase(text, orig) {
2201
2201
  }
2202
2202
  return text;
2203
2203
  }
2204
+ var getLastLetter = (word) => {
2205
+ for (let i = word.length - 1; i > 1; i--)
2206
+ if (/\p{L}/u.test(word[i]))
2207
+ return word[i];
2208
+ };
2204
2209
  function toTags(text, orig, abc, applyF) {
2205
2210
  for (let i = 0; i < text.length; i++) {
2206
2211
  const word = text[i];
package/dist/index.js CHANGED
@@ -2160,7 +2160,7 @@ function restoreCase(text, orig) {
2160
2160
  continue;
2161
2161
  if (word === "зь") {
2162
2162
  text[i] = isUpperCase(orig[i + 1]) ? "ЗЬ" : "Зь";
2163
- } else if (isUpperCase(oWord[oWord.length - 1])) {
2163
+ } else if (isUpperCase(getLastLetter(oWord))) {
2164
2164
  text[i] = word.toUpperCase();
2165
2165
  } else {
2166
2166
  text[i] = word[0] === "(" ? word.replace(
@@ -2171,6 +2171,11 @@ function restoreCase(text, orig) {
2171
2171
  }
2172
2172
  return text;
2173
2173
  }
2174
+ var getLastLetter = (word) => {
2175
+ for (let i = word.length - 1; i > 1; i--)
2176
+ if (/\p{L}/u.test(word[i]))
2177
+ return word[i];
2178
+ };
2174
2179
  function toTags(text, orig, abc, applyF) {
2175
2180
  for (let i = 0; i < text.length; i++) {
2176
2181
  const word = text[i];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "taraskevizer",
3
3
  "author": "GooseOb",
4
4
  "license": "MIT",
5
- "version": "1.4.0",
5
+ "version": "1.4.1",
6
6
  "private": false,
7
7
  "homepage": "https://gooseob.github.io/taraskevizatar/",
8
8
  "main": "dist/index.js",