taraskevizer 7.0.1 → 7.0.3

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/README.md CHANGED
@@ -83,6 +83,9 @@ Type: `object` with schema: `{lower: Dict, upper?: Dict}`,
83
83
  where `Dict` is `[pattern: RegExp, result: string][]`
84
84
  (may be empty)
85
85
 
86
+ `ALPHABET` contains the following pre-defined alphabets:
87
+ `CYRILLIC`, `LATIN`, `LATIN_JI`, `ARABIC`
88
+
86
89
  Default value: `ALPHABET.CYRILLIC`
87
90
 
88
91
  ### j
@@ -108,7 +111,7 @@ Default `true`
108
111
 
109
112
  If set to false, may cause unwanted changes in acronyms.
110
113
 
111
- Is always `false` in `convertAlphabetOnly`.
114
+ Is always `false` in `abcOnlyPipeline`.
112
115
 
113
116
  ## html
114
117
 
package/dist/bin.js CHANGED
@@ -16,7 +16,7 @@ const printWithPrefix = (msg) => {
16
16
  process.argv.splice(0, 2);
17
17
  const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
18
18
  if (checkForOptions(["-v", "--version"])) {
19
- printWithPrefix("7.0.1");
19
+ printWithPrefix("7.0.3");
20
20
  process.exit(0);
21
21
  }
22
22
  if (checkForOptions(["-h", "--help"])) {
package/dist/index.cjs CHANGED
@@ -28,8 +28,8 @@ __export(src_exports, {
28
28
  dicts: () => dict_exports,
29
29
  htmlPipeline: () => htmlPipeline,
30
30
  lib: () => lib_exports,
31
- pipelineSteps: () => steps_exports,
32
31
  plainTextPipeline: () => plainTextPipeline,
32
+ steps: () => steps_exports,
33
33
  tarask: () => tarask
34
34
  });
35
35
  module.exports = __toCommonJS(src_exports);
@@ -2477,37 +2477,14 @@ var taraskevize = (text) => {
2477
2477
  // src/steps/whitespaces.ts
2478
2478
  var whitespacesToSpaces = (text, { storage }) => {
2479
2479
  storage.spaces = [];
2480
- storage.positions = [];
2481
- let result = "";
2482
- let i = 0;
2483
- while (i < text.length) {
2484
- if (/\s/.test(text[i])) {
2485
- let start = i;
2486
- while (i < text.length && /\s/.test(text[i]))
2487
- ++i;
2488
- storage.spaces.push(text.slice(start, i));
2489
- storage.positions.push(result.length);
2490
- result += " ";
2491
- } else {
2492
- result += text[i];
2493
- ++i;
2494
- }
2495
- }
2496
- return result;
2480
+ return text.replace(/\s+/g, (match) => {
2481
+ storage.spaces.push(match);
2482
+ return " ";
2483
+ });
2497
2484
  };
2498
2485
  var restoreWhitespaces = (text, { storage }) => {
2499
- let result = "";
2500
- let lastIndex = 0;
2501
- let spaceIndex = 0;
2502
- for (let i = 0; i < text.length; i++) {
2503
- if (text[i] === " " && spaceIndex < storage.spaces.length) {
2504
- result += text.slice(lastIndex, i) + storage.spaces[spaceIndex];
2505
- lastIndex = i + 1;
2506
- ++spaceIndex;
2507
- }
2508
- }
2509
- result += text.slice(lastIndex);
2510
- return result;
2486
+ storage.spaces.reverse();
2487
+ return text.replace(/ /g, () => storage.spaces.pop());
2511
2488
  };
2512
2489
 
2513
2490
  // src/steps/trim.ts
@@ -2587,7 +2564,7 @@ var htmlPipeline = createPipeline(
2587
2564
  dicts,
2588
2565
  htmlPipeline,
2589
2566
  lib,
2590
- pipelineSteps,
2591
2567
  plainTextPipeline,
2568
+ steps,
2592
2569
  tarask
2593
2570
  });
package/dist/index.d.ts CHANGED
@@ -137,7 +137,6 @@ declare const taraskevize: TaraskStep;
137
137
 
138
138
  type WhiteSpaceStorage = {
139
139
  spaces: string[];
140
- positions: number[];
141
140
  };
142
141
  declare const whitespacesToSpaces: TaraskStep<WhiteSpaceStorage>;
143
142
  declare const restoreWhitespaces: TaraskStep<WhiteSpaceStorage>;
@@ -195,7 +194,6 @@ declare const abcOnlyPipeline: (TaraskStep<{
195
194
  noFixArr: string[];
196
195
  }> | TaraskStep<{
197
196
  spaces: string[];
198
- positions: number[];
199
197
  }> | ((_: string, { storage, cfg: { general } }: {
200
198
  storage: {
201
199
  doEscapeCapitalized: boolean;
@@ -206,13 +204,11 @@ declare const plainTextPipeline: (TaraskStep<SplittedTextStorage> | TaraskStep<{
206
204
  noFixArr: string[];
207
205
  }> | TaraskStep<{
208
206
  spaces: string[];
209
- positions: number[];
210
207
  }>)[];
211
208
  declare const htmlPipeline: (TaraskStep<SplittedTextStorage> | TaraskStep<{
212
209
  noFixArr: string[];
213
210
  }> | TaraskStep<{
214
211
  spaces: string[];
215
- positions: number[];
216
212
  }>)[];
217
213
 
218
214
  declare const afterTarask: ExtendedDict;
@@ -251,4 +247,4 @@ declare namespace index {
251
247
  export { index_afterTarask as afterTarask, index_ansiColorWrappers as ansiColorWrappers, index_dictFrom as dictFrom, index_highlightDiff as highlightDiff, index_htmlWrappers as htmlWrappers, index_replaceG as replaceG, index_replaceWithDict as replaceWithDict, index_restoreCase as restoreCase };
252
248
  }
253
249
 
254
- export { ALPHABET, type HtmlOptions, type NonHtmlOptions, REPLACE_J, TaraskConfig, type TaraskOptions, VARIATION, abcOnlyPipeline, index$2 as dicts, htmlPipeline, index as lib, index$1 as pipelineSteps, plainTextPipeline, tarask };
250
+ export { ALPHABET, type HtmlOptions, type NonHtmlOptions, REPLACE_J, TaraskConfig, type TaraskOptions, VARIATION, abcOnlyPipeline, index$2 as dicts, htmlPipeline, index as lib, plainTextPipeline, index$1 as steps, tarask };
package/dist/index.js CHANGED
@@ -2447,37 +2447,14 @@ var taraskevize = (text) => {
2447
2447
  // src/steps/whitespaces.ts
2448
2448
  var whitespacesToSpaces = (text, { storage }) => {
2449
2449
  storage.spaces = [];
2450
- storage.positions = [];
2451
- let result = "";
2452
- let i = 0;
2453
- while (i < text.length) {
2454
- if (/\s/.test(text[i])) {
2455
- let start = i;
2456
- while (i < text.length && /\s/.test(text[i]))
2457
- ++i;
2458
- storage.spaces.push(text.slice(start, i));
2459
- storage.positions.push(result.length);
2460
- result += " ";
2461
- } else {
2462
- result += text[i];
2463
- ++i;
2464
- }
2465
- }
2466
- return result;
2450
+ return text.replace(/\s+/g, (match) => {
2451
+ storage.spaces.push(match);
2452
+ return " ";
2453
+ });
2467
2454
  };
2468
2455
  var restoreWhitespaces = (text, { storage }) => {
2469
- let result = "";
2470
- let lastIndex = 0;
2471
- let spaceIndex = 0;
2472
- for (let i = 0; i < text.length; i++) {
2473
- if (text[i] === " " && spaceIndex < storage.spaces.length) {
2474
- result += text.slice(lastIndex, i) + storage.spaces[spaceIndex];
2475
- lastIndex = i + 1;
2476
- ++spaceIndex;
2477
- }
2478
- }
2479
- result += text.slice(lastIndex);
2480
- return result;
2456
+ storage.spaces.reverse();
2457
+ return text.replace(/ /g, () => storage.spaces.pop());
2481
2458
  };
2482
2459
 
2483
2460
  // src/steps/trim.ts
@@ -2556,7 +2533,7 @@ export {
2556
2533
  dict_exports as dicts,
2557
2534
  htmlPipeline,
2558
2535
  lib_exports as lib,
2559
- steps_exports as pipelineSteps,
2560
2536
  plainTextPipeline,
2537
+ steps_exports as steps,
2561
2538
  tarask
2562
2539
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",