taraskevizer 8.0.5 → 8.0.7

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/bin.js CHANGED
@@ -14,7 +14,7 @@ const printWithPrefix = (msg) => {
14
14
  process.argv.splice(0, 2);
15
15
  const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
16
16
  if (checkForOptions(["-v", "--version"])) {
17
- printWithPrefix("8.0.5");
17
+ printWithPrefix("8.0.7");
18
18
  process.exit(0);
19
19
  }
20
20
  if (checkForOptions(["-h", "--help"])) {
@@ -75,8 +75,7 @@ let mode = "plainText";
75
75
  const toHashTable = (dict) => {
76
76
  const result = {};
77
77
  for (const [options, callback] of dict)
78
- for (const option of options)
79
- result[option] = callback;
78
+ for (const option of options) result[option] = callback;
80
79
  return result;
81
80
  };
82
81
  const optionDict = toHashTable([
@@ -177,8 +176,7 @@ if (process.argv.length) {
177
176
  for await (const chunk of process.stdin) {
178
177
  chunks.push(chunk);
179
178
  length += chunk.length;
180
- if (chunk.includes("\n"))
181
- break;
179
+ if (chunk.includes("\n")) break;
182
180
  }
183
181
  } else {
184
182
  for await (const chunk of process.stdin) {
package/dist/index.cjs CHANGED
@@ -1,35 +1,10 @@
1
- "use strict";
1
+ 'use strict';
2
+
2
3
  var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __export = (target, all) => {
7
5
  for (var name in all)
8
6
  __defProp(target, name, { get: all[name], enumerable: true });
9
7
  };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- REPLACE_J: () => REPLACE_J,
24
- TaraskConfig: () => TaraskConfig,
25
- VARIATION: () => VARIATION,
26
- dicts: () => dict_exports,
27
- lib: () => lib_exports,
28
- pipelines: () => pipelines_exports,
29
- steps: () => steps_exports,
30
- tarask: () => tarask
31
- });
32
- module.exports = __toCommonJS(src_exports);
33
8
 
34
9
  // src/dict/index.ts
35
10
  var dict_exports = {};
@@ -63,8 +38,7 @@ var dictFrom = {
63
38
  * Adds the global flag to all patterns in the dictionary.
64
39
  */
65
40
  nonGlobal: (dict) => {
66
- for (const item of dict)
67
- item[0] = RegExp(item[0], "g" + item[0].flags);
41
+ for (const item of dict) item[0] = RegExp(item[0], "g" + item[0].flags);
68
42
  return dict;
69
43
  }
70
44
  };
@@ -1898,10 +1872,10 @@ var common = {
1898
1872
  ].map(dictFrom.nonGlobal),
1899
1873
  upper: [
1900
1874
  [
1901
- [new RegExp(" Е(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Je"],
1902
- [new RegExp(" Ё(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Jo"],
1903
- [new RegExp(" Ю(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ju"],
1904
- [new RegExp(" Я(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ja"]
1875
+ [/ Е(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Je"],
1876
+ [/ Ё(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Jo"],
1877
+ [/ Ю(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ju"],
1878
+ [/ Я(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ja"]
1905
1879
  ],
1906
1880
  [
1907
1881
  [/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)Е/, "$1JE"],
@@ -1975,7 +1949,7 @@ var latinJi = {
1975
1949
  ]),
1976
1950
  upper: [
1977
1951
  ...common.upper[0],
1978
- [new RegExp("([eoua] *)І(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "gu"), "$1Ji"],
1952
+ [/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, "$1Ji"],
1979
1953
  ...common.upper[1],
1980
1954
  [/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, "$1JI"],
1981
1955
  ...common.upper[2],
@@ -2063,8 +2037,7 @@ var VARIATION = {
2063
2037
  // src/config.ts
2064
2038
  var TaraskConfig = class {
2065
2039
  constructor(options) {
2066
- if (!options)
2067
- return;
2040
+ if (!options) return;
2068
2041
  for (const [target, source] of [
2069
2042
  [this.general, options.general],
2070
2043
  [this.html, options.html],
@@ -2072,8 +2045,7 @@ var TaraskConfig = class {
2072
2045
  ]) {
2073
2046
  if (source)
2074
2047
  for (const [key, value] of Object.entries(source)) {
2075
- if (value !== void 0)
2076
- target[key] = value;
2048
+ if (value !== void 0) target[key] = value;
2077
2049
  }
2078
2050
  }
2079
2051
  }
@@ -2098,8 +2070,7 @@ var TaraskConfig = class {
2098
2070
  // src/tarask.ts
2099
2071
  var tarask = (text, pipeline, cfg = new TaraskConfig()) => {
2100
2072
  const options = { text, cfg, storage: {} };
2101
- for (const step of pipeline)
2102
- step(options);
2073
+ for (const step of pipeline) step(options);
2103
2074
  return options.text;
2104
2075
  };
2105
2076
 
@@ -2146,10 +2117,7 @@ __export(lib_exports, {
2146
2117
  });
2147
2118
 
2148
2119
  // src/lib/after-tarask.ts
2149
- var iaReplacer = ($0, $1, $2) => {
2150
- var _a;
2151
- return ((_a = $2.match(/[аеёіоуыэюя]/g)) == null ? void 0 : _a.length) === 1 ? $1 + "я" + $2 : $0;
2152
- };
2120
+ var iaReplacer = ($0, $1, $2) => $2.match(/[аеёіоуыэюя]/g)?.length === 1 ? $1 + "я" + $2 : $0;
2153
2121
  var afterTarask = [
2154
2122
  [/( б)е(зь? \S+)/g, iaReplacer],
2155
2123
  [/( н)е( \S+)/g, iaReplacer],
@@ -2172,17 +2140,14 @@ var highlightDiff = (text, orig, isCyrillic, highlight) => {
2172
2140
  for (let i = 0; i < text.length; i++) {
2173
2141
  const word = text[i];
2174
2142
  const oWord = orig[i];
2175
- if (oWord === word)
2176
- continue;
2143
+ if (oWord === word) continue;
2177
2144
  const wordH = isCyrillic ? replaceGByOpposite(word) : word;
2178
- if (oWord === wordH)
2179
- continue;
2145
+ if (oWord === wordH) continue;
2180
2146
  if (!/\(/.test(word)) {
2181
2147
  if (word.length === oWord.length) {
2182
2148
  const wordLetters = word.split("");
2183
2149
  for (let j = 0; j < wordLetters.length; j++) {
2184
- if (wordH[j] !== oWord[j])
2185
- wordLetters[j] = highlight(wordLetters[j]);
2150
+ if (wordH[j] !== oWord[j]) wordLetters[j] = highlight(wordLetters[j]);
2186
2151
  }
2187
2152
  text[i] = wordLetters.join("");
2188
2153
  continue;
@@ -2203,8 +2168,7 @@ var highlightDiff = (text, orig, isCyrillic, highlight) => {
2203
2168
  let fromStart = 0;
2204
2169
  let fromWordEnd = word.length - 1;
2205
2170
  let fromOWordEnd = oWordEnd;
2206
- while (wordH[fromStart] === oWord[fromStart])
2207
- ++fromStart;
2171
+ while (wordH[fromStart] === oWord[fromStart]) ++fromStart;
2208
2172
  while (wordH[fromWordEnd] === oWord[fromOWordEnd]) {
2209
2173
  --fromWordEnd;
2210
2174
  --fromOWordEnd;
@@ -2214,8 +2178,7 @@ var highlightDiff = (text, orig, isCyrillic, highlight) => {
2214
2178
  text[i] = highlight(word);
2215
2179
  continue;
2216
2180
  }
2217
- if (fromWordEnd < 0)
2218
- fromWordEnd = 0;
2181
+ if (fromWordEnd < 0) fromWordEnd = 0;
2219
2182
  }
2220
2183
  if (fromStart === fromWordEnd + 1) {
2221
2184
  --fromStart;
@@ -2239,9 +2202,8 @@ var replaceWithDict = (text, dict = []) => {
2239
2202
  // src/lib/restore-case.ts
2240
2203
  var isUpperCase = (str) => str === str.toUpperCase();
2241
2204
  var getLastLetter = (word, i) => {
2242
- const result = new RegExp("\\p{L}(?=[^\\p{L}]*$)", "u").exec(word);
2243
- if (result)
2244
- return result[0];
2205
+ const result = /\p{L}(?=[^\p{L}]*$)/u.exec(word);
2206
+ if (result) return result[0];
2245
2207
  throw new Error(
2246
2208
  `the last letter of the word "${word}" not found. index: ${i}`
2247
2209
  );
@@ -2250,14 +2212,12 @@ var restoreCase = (text, orig) => {
2250
2212
  for (let i = 0; i < text.length; i++) {
2251
2213
  const word = text[i];
2252
2214
  const oWord = orig[i];
2253
- if (word === oWord)
2254
- continue;
2215
+ if (word === oWord) continue;
2255
2216
  if (word === oWord.toLowerCase()) {
2256
2217
  text[i] = oWord;
2257
2218
  continue;
2258
2219
  }
2259
- if (!oWord[0] || !isUpperCase(oWord[0]))
2260
- continue;
2220
+ if (!oWord[0] || !isUpperCase(oWord[0])) continue;
2261
2221
  if (word === "зь") {
2262
2222
  text[i] = isUpperCase(orig[i + 1]) ? "ЗЬ" : "Зь";
2263
2223
  } else if (isUpperCase(getLastLetter(oWord, i))) {
@@ -2391,7 +2351,7 @@ var applyVariationsNonHtml = (options) => {
2391
2351
 
2392
2352
  // src/steps/prepare.ts
2393
2353
  var prepare = mutatingStep(
2394
- ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(new RegExp("(\\p{P}|\\p{S}|\\d+)", "gu"), " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2354
+ ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(/(\p{P}|\p{S}|\d+)/gu, " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2395
2355
  );
2396
2356
 
2397
2357
  // src/steps/resolve-syntax.ts
@@ -2418,15 +2378,14 @@ var resolveSpecialSyntax = (leftAngleBracket) => mutatingStep(
2418
2378
  abcOnlyText.split(" ")
2419
2379
  ).join(" ");
2420
2380
  const escapeCapsIfNeeded = (text2) => doEscapeCapitalized ? text2.replace(
2421
- new RegExp("(?!<=\\p{Lu} )\\p{Lu}{2}[\\p{Lu} ]*(?!= \\p{Lu})", "gu"),
2381
+ /(?!<=\p{Lu} )\p{Lu}{2}[\p{Lu} ]*(?!= \p{Lu})/gu,
2422
2382
  ($0) => {
2423
2383
  noFixArr.push(convertAlphavet($0, abc));
2424
2384
  return NOFIX_CHAR;
2425
2385
  }
2426
2386
  ) : text2;
2427
2387
  const parts = text.split(/(?=[<>])/g);
2428
- if (parts.length === 1)
2429
- return escapeCapsIfNeeded(text);
2388
+ if (parts.length === 1) return escapeCapsIfNeeded(text);
2430
2389
  let result = text.startsWith("<") ? "" : escapeCapsIfNeeded(parts.shift());
2431
2390
  let depth = 0;
2432
2391
  let currentPart = "";
@@ -2486,8 +2445,7 @@ var restoreCaseStep = ({
2486
2445
  restoreCase(textArr, origArr);
2487
2446
  } else {
2488
2447
  for (let i = 0; i < textArr.length; i++) {
2489
- if (origArr[i] !== origArr[i].toLowerCase())
2490
- textArr[i] = origArr[i];
2448
+ if (origArr[i] !== origArr[i].toLowerCase()) textArr[i] = origArr[i];
2491
2449
  }
2492
2450
  }
2493
2451
  };
@@ -2519,14 +2477,12 @@ var storeSplittedText = ({
2519
2477
  var wordlistPlusNoSoften = wordlist.concat(noSoften);
2520
2478
  var taraskevize = mutatingStep(({ text }) => {
2521
2479
  text = replaceWithDict(text, wordlistPlusNoSoften);
2522
- softening:
2523
- do {
2524
- text = replaceWithDict(text, softeners);
2525
- for (const [pattern, result] of softeners)
2526
- if (result !== "$1дзьдз" && pattern.test(text))
2527
- continue softening;
2528
- break;
2529
- } while (true);
2480
+ softening: do {
2481
+ text = replaceWithDict(text, softeners);
2482
+ for (const [pattern, result] of softeners)
2483
+ if (result !== "$1дзьдз" && pattern.test(text)) continue softening;
2484
+ break;
2485
+ } while (true);
2530
2486
  return replaceWithDict(
2531
2487
  text.replace(//g, "").replace(/не пра/g, "не&nbsp;пра"),
2532
2488
  afterTarask
@@ -2555,7 +2511,7 @@ var trim = mutatingStep(({ text }) => ` ${text.trim()} `);
2555
2511
 
2556
2512
  // src/steps/finalize.ts
2557
2513
  var finalize = (newLine) => mutatingStep(
2558
- ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d+) ", "gu"), "$1").replace(/\n/g, newLine).trim()
2514
+ ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(/ (\p{P}|\p{S}|\d+) /gu, "$1").replace(/\n/g, newLine).trim()
2559
2515
  );
2560
2516
 
2561
2517
  // src/steps/to-lower-case.ts
@@ -2621,14 +2577,12 @@ var html = createPipeline(
2621
2577
  finalize("<br>"),
2622
2578
  highlightDiffStep(htmlWrappers.fix)
2623
2579
  );
2624
- // Annotate the CommonJS export names for ESM import in node:
2625
- 0 && (module.exports = {
2626
- REPLACE_J,
2627
- TaraskConfig,
2628
- VARIATION,
2629
- dicts,
2630
- lib,
2631
- pipelines,
2632
- steps,
2633
- tarask
2634
- });
2580
+
2581
+ exports.REPLACE_J = REPLACE_J;
2582
+ exports.TaraskConfig = TaraskConfig;
2583
+ exports.VARIATION = VARIATION;
2584
+ exports.dicts = dict_exports;
2585
+ exports.lib = lib_exports;
2586
+ exports.pipelines = pipelines_exports;
2587
+ exports.steps = steps_exports;
2588
+ exports.tarask = tarask;
package/dist/index.js CHANGED
@@ -36,8 +36,7 @@ var dictFrom = {
36
36
  * Adds the global flag to all patterns in the dictionary.
37
37
  */
38
38
  nonGlobal: (dict) => {
39
- for (const item of dict)
40
- item[0] = RegExp(item[0], "g" + item[0].flags);
39
+ for (const item of dict) item[0] = RegExp(item[0], "g" + item[0].flags);
41
40
  return dict;
42
41
  }
43
42
  };
@@ -1871,10 +1870,10 @@ var common = {
1871
1870
  ].map(dictFrom.nonGlobal),
1872
1871
  upper: [
1873
1872
  [
1874
- [new RegExp(" Е(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Je"],
1875
- [new RegExp(" Ё(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Jo"],
1876
- [new RegExp(" Ю(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ju"],
1877
- [new RegExp(" Я(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "u"), " Ja"]
1873
+ [/ Е(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Je"],
1874
+ [/ Ё(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Jo"],
1875
+ [/ Ю(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ju"],
1876
+ [/ Я(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, " Ja"]
1878
1877
  ],
1879
1878
  [
1880
1879
  [/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)Е/, "$1JE"],
@@ -1948,7 +1947,7 @@ var latinJi = {
1948
1947
  ]),
1949
1948
  upper: [
1950
1949
  ...common.upper[0],
1951
- [new RegExp("([eoua] *)І(?=[ \\p{P}\\d]*\\p{Lu}?\\p{Ll})", "gu"), "$1Ji"],
1950
+ [/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, "$1Ji"],
1952
1951
  ...common.upper[1],
1953
1952
  [/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, "$1JI"],
1954
1953
  ...common.upper[2],
@@ -2036,8 +2035,7 @@ var VARIATION = {
2036
2035
  // src/config.ts
2037
2036
  var TaraskConfig = class {
2038
2037
  constructor(options) {
2039
- if (!options)
2040
- return;
2038
+ if (!options) return;
2041
2039
  for (const [target, source] of [
2042
2040
  [this.general, options.general],
2043
2041
  [this.html, options.html],
@@ -2045,8 +2043,7 @@ var TaraskConfig = class {
2045
2043
  ]) {
2046
2044
  if (source)
2047
2045
  for (const [key, value] of Object.entries(source)) {
2048
- if (value !== void 0)
2049
- target[key] = value;
2046
+ if (value !== void 0) target[key] = value;
2050
2047
  }
2051
2048
  }
2052
2049
  }
@@ -2071,8 +2068,7 @@ var TaraskConfig = class {
2071
2068
  // src/tarask.ts
2072
2069
  var tarask = (text, pipeline, cfg = new TaraskConfig()) => {
2073
2070
  const options = { text, cfg, storage: {} };
2074
- for (const step of pipeline)
2075
- step(options);
2071
+ for (const step of pipeline) step(options);
2076
2072
  return options.text;
2077
2073
  };
2078
2074
 
@@ -2119,10 +2115,7 @@ __export(lib_exports, {
2119
2115
  });
2120
2116
 
2121
2117
  // src/lib/after-tarask.ts
2122
- var iaReplacer = ($0, $1, $2) => {
2123
- var _a;
2124
- return ((_a = $2.match(/[аеёіоуыэюя]/g)) == null ? void 0 : _a.length) === 1 ? $1 + "я" + $2 : $0;
2125
- };
2118
+ var iaReplacer = ($0, $1, $2) => $2.match(/[аеёіоуыэюя]/g)?.length === 1 ? $1 + "я" + $2 : $0;
2126
2119
  var afterTarask = [
2127
2120
  [/( б)е(зь? \S+)/g, iaReplacer],
2128
2121
  [/( н)е( \S+)/g, iaReplacer],
@@ -2145,17 +2138,14 @@ var highlightDiff = (text, orig, isCyrillic, highlight) => {
2145
2138
  for (let i = 0; i < text.length; i++) {
2146
2139
  const word = text[i];
2147
2140
  const oWord = orig[i];
2148
- if (oWord === word)
2149
- continue;
2141
+ if (oWord === word) continue;
2150
2142
  const wordH = isCyrillic ? replaceGByOpposite(word) : word;
2151
- if (oWord === wordH)
2152
- continue;
2143
+ if (oWord === wordH) continue;
2153
2144
  if (!/\(/.test(word)) {
2154
2145
  if (word.length === oWord.length) {
2155
2146
  const wordLetters = word.split("");
2156
2147
  for (let j = 0; j < wordLetters.length; j++) {
2157
- if (wordH[j] !== oWord[j])
2158
- wordLetters[j] = highlight(wordLetters[j]);
2148
+ if (wordH[j] !== oWord[j]) wordLetters[j] = highlight(wordLetters[j]);
2159
2149
  }
2160
2150
  text[i] = wordLetters.join("");
2161
2151
  continue;
@@ -2176,8 +2166,7 @@ var highlightDiff = (text, orig, isCyrillic, highlight) => {
2176
2166
  let fromStart = 0;
2177
2167
  let fromWordEnd = word.length - 1;
2178
2168
  let fromOWordEnd = oWordEnd;
2179
- while (wordH[fromStart] === oWord[fromStart])
2180
- ++fromStart;
2169
+ while (wordH[fromStart] === oWord[fromStart]) ++fromStart;
2181
2170
  while (wordH[fromWordEnd] === oWord[fromOWordEnd]) {
2182
2171
  --fromWordEnd;
2183
2172
  --fromOWordEnd;
@@ -2187,8 +2176,7 @@ var highlightDiff = (text, orig, isCyrillic, highlight) => {
2187
2176
  text[i] = highlight(word);
2188
2177
  continue;
2189
2178
  }
2190
- if (fromWordEnd < 0)
2191
- fromWordEnd = 0;
2179
+ if (fromWordEnd < 0) fromWordEnd = 0;
2192
2180
  }
2193
2181
  if (fromStart === fromWordEnd + 1) {
2194
2182
  --fromStart;
@@ -2212,9 +2200,8 @@ var replaceWithDict = (text, dict = []) => {
2212
2200
  // src/lib/restore-case.ts
2213
2201
  var isUpperCase = (str) => str === str.toUpperCase();
2214
2202
  var getLastLetter = (word, i) => {
2215
- const result = new RegExp("\\p{L}(?=[^\\p{L}]*$)", "u").exec(word);
2216
- if (result)
2217
- return result[0];
2203
+ const result = /\p{L}(?=[^\p{L}]*$)/u.exec(word);
2204
+ if (result) return result[0];
2218
2205
  throw new Error(
2219
2206
  `the last letter of the word "${word}" not found. index: ${i}`
2220
2207
  );
@@ -2223,14 +2210,12 @@ var restoreCase = (text, orig) => {
2223
2210
  for (let i = 0; i < text.length; i++) {
2224
2211
  const word = text[i];
2225
2212
  const oWord = orig[i];
2226
- if (word === oWord)
2227
- continue;
2213
+ if (word === oWord) continue;
2228
2214
  if (word === oWord.toLowerCase()) {
2229
2215
  text[i] = oWord;
2230
2216
  continue;
2231
2217
  }
2232
- if (!oWord[0] || !isUpperCase(oWord[0]))
2233
- continue;
2218
+ if (!oWord[0] || !isUpperCase(oWord[0])) continue;
2234
2219
  if (word === "зь") {
2235
2220
  text[i] = isUpperCase(orig[i + 1]) ? "ЗЬ" : "Зь";
2236
2221
  } else if (isUpperCase(getLastLetter(oWord, i))) {
@@ -2364,7 +2349,7 @@ var applyVariationsNonHtml = (options) => {
2364
2349
 
2365
2350
  // src/steps/prepare.ts
2366
2351
  var prepare = mutatingStep(
2367
- ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(new RegExp("(\\p{P}|\\p{S}|\\d+)", "gu"), " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2352
+ ({ text }) => text.replace(/г'(?![еёіюя])/g, "ґ").replace(/ - /g, " — ").replace(/(\p{P}|\p{S}|\d+)/gu, " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "&#40")
2368
2353
  );
2369
2354
 
2370
2355
  // src/steps/resolve-syntax.ts
@@ -2391,15 +2376,14 @@ var resolveSpecialSyntax = (leftAngleBracket) => mutatingStep(
2391
2376
  abcOnlyText.split(" ")
2392
2377
  ).join(" ");
2393
2378
  const escapeCapsIfNeeded = (text2) => doEscapeCapitalized ? text2.replace(
2394
- new RegExp("(?!<=\\p{Lu} )\\p{Lu}{2}[\\p{Lu} ]*(?!= \\p{Lu})", "gu"),
2379
+ /(?!<=\p{Lu} )\p{Lu}{2}[\p{Lu} ]*(?!= \p{Lu})/gu,
2395
2380
  ($0) => {
2396
2381
  noFixArr.push(convertAlphavet($0, abc));
2397
2382
  return NOFIX_CHAR;
2398
2383
  }
2399
2384
  ) : text2;
2400
2385
  const parts = text.split(/(?=[<>])/g);
2401
- if (parts.length === 1)
2402
- return escapeCapsIfNeeded(text);
2386
+ if (parts.length === 1) return escapeCapsIfNeeded(text);
2403
2387
  let result = text.startsWith("<") ? "" : escapeCapsIfNeeded(parts.shift());
2404
2388
  let depth = 0;
2405
2389
  let currentPart = "";
@@ -2459,8 +2443,7 @@ var restoreCaseStep = ({
2459
2443
  restoreCase(textArr, origArr);
2460
2444
  } else {
2461
2445
  for (let i = 0; i < textArr.length; i++) {
2462
- if (origArr[i] !== origArr[i].toLowerCase())
2463
- textArr[i] = origArr[i];
2446
+ if (origArr[i] !== origArr[i].toLowerCase()) textArr[i] = origArr[i];
2464
2447
  }
2465
2448
  }
2466
2449
  };
@@ -2492,14 +2475,12 @@ var storeSplittedText = ({
2492
2475
  var wordlistPlusNoSoften = wordlist.concat(noSoften);
2493
2476
  var taraskevize = mutatingStep(({ text }) => {
2494
2477
  text = replaceWithDict(text, wordlistPlusNoSoften);
2495
- softening:
2496
- do {
2497
- text = replaceWithDict(text, softeners);
2498
- for (const [pattern, result] of softeners)
2499
- if (result !== "$1дзьдз" && pattern.test(text))
2500
- continue softening;
2501
- break;
2502
- } while (true);
2478
+ softening: do {
2479
+ text = replaceWithDict(text, softeners);
2480
+ for (const [pattern, result] of softeners)
2481
+ if (result !== "$1дзьдз" && pattern.test(text)) continue softening;
2482
+ break;
2483
+ } while (true);
2503
2484
  return replaceWithDict(
2504
2485
  text.replace(//g, "").replace(/не пра/g, "не&nbsp;пра"),
2505
2486
  afterTarask
@@ -2528,7 +2509,7 @@ var trim = mutatingStep(({ text }) => ` ${text.trim()} `);
2528
2509
 
2529
2510
  // src/steps/finalize.ts
2530
2511
  var finalize = (newLine) => mutatingStep(
2531
- ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d+) ", "gu"), "$1").replace(/\n/g, newLine).trim()
2512
+ ({ text }) => text.replace(/&#40/g, "(").replace(/&nbsp;/g, " ").replace(/ (\p{P}|\p{S}|\d+) /gu, "$1").replace(/\n/g, newLine).trim()
2532
2513
  );
2533
2514
 
2534
2515
  // src/steps/to-lower-case.ts
@@ -2594,13 +2575,5 @@ var html = createPipeline(
2594
2575
  finalize("<br>"),
2595
2576
  highlightDiffStep(htmlWrappers.fix)
2596
2577
  );
2597
- export {
2598
- REPLACE_J,
2599
- TaraskConfig,
2600
- VARIATION,
2601
- dict_exports as dicts,
2602
- lib_exports as lib,
2603
- pipelines_exports as pipelines,
2604
- steps_exports as steps,
2605
- tarask
2606
- };
2578
+
2579
+ export { REPLACE_J, TaraskConfig, VARIATION, dict_exports as dicts, lib_exports as lib, pipelines_exports as pipelines, steps_exports as steps, tarask };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "8.0.5",
3
+ "version": "8.0.7",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,7 +10,6 @@
10
10
  "module": "dist/index.js",
11
11
  "devDependencies": {
12
12
  "@digitak/esrun": "^3.2.26",
13
- "@types/diff": "^5.2.0",
14
13
  "@types/node": "^20.12.7",
15
14
  "bun-types": "^1.1.4",
16
15
  "husky": "^9.0.11",
@@ -49,7 +48,7 @@
49
48
  "test": "esrun --send-code-mode=temporaryFile test",
50
49
  "test-cli": "bun run build && esrun --send-code-mode=temporaryFile test",
51
50
  "postinstall": "husky",
52
- "docs": "typedoc --out docs src/index.ts --skipErrorChecking"
51
+ "docs": "typedoc"
53
52
  },
54
53
  "sideEffects": false,
55
54
  "type": "module",