taraskevizer 7.0.1 → 7.0.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/bin.js +1 -1
- package/dist/index.cjs +6 -29
- package/dist/index.d.ts +0 -4
- package/dist/index.js +6 -29
- package/package.json +1 -1
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.
|
|
19
|
+
printWithPrefix("7.0.2");
|
|
20
20
|
process.exit(0);
|
|
21
21
|
}
|
|
22
22
|
if (checkForOptions(["-h", "--help"])) {
|
package/dist/index.cjs
CHANGED
|
@@ -2477,37 +2477,14 @@ var taraskevize = (text) => {
|
|
|
2477
2477
|
// src/steps/whitespaces.ts
|
|
2478
2478
|
var whitespacesToSpaces = (text, { storage }) => {
|
|
2479
2479
|
storage.spaces = [];
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
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
|
-
|
|
2500
|
-
|
|
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
|
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;
|
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
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
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
|
-
|
|
2470
|
-
|
|
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
|