taraskevizer 10.3.0 → 10.3.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 +2 -0
- package/dist/bin.js +1 -1
- package/dist/dict/alphabets/types.d.ts +3 -3
- package/dist/dict/types.d.ts +4 -4
- package/dist/dict/wordlist.js +2 -2
- package/dist/lib/debug.d.ts +1 -1
- package/dist/lib/debug.js +3 -3
- package/dist/lib/highlight-diff.js +4 -4
- package/dist/lib/mutating-step.d.ts +1 -1
- package/dist/steps/taraskevize.js +2 -1
- package/package.json +7 -6
- package/LICENSE.txt +0 -21
package/README.md
CHANGED
package/dist/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ process.argv.splice(0, 2);
|
|
|
7
7
|
const firstArg = process.argv[0];
|
|
8
8
|
if (firstArg) {
|
|
9
9
|
if (firstArg === '-v' || firstArg === '--version') {
|
|
10
|
-
printWithPrefix("10.3.
|
|
10
|
+
printWithPrefix("10.3.3");
|
|
11
11
|
process.exit(0);
|
|
12
12
|
}
|
|
13
13
|
if (firstArg === '-h' || firstArg === '--help') {
|
|
@@ -5,7 +5,7 @@ import type { CallableDict } from '../types';
|
|
|
5
5
|
* so {@link Alphabet.lower} should replace both
|
|
6
6
|
* upper and lower case letters.
|
|
7
7
|
*/
|
|
8
|
-
export type Alphabet = {
|
|
9
|
-
lower: CallableDict
|
|
10
|
-
upper?: CallableDict
|
|
8
|
+
export type Alphabet<LowerPattern = RegExp, UpperPattern = LowerPattern> = {
|
|
9
|
+
lower: CallableDict<LowerPattern>;
|
|
10
|
+
upper?: CallableDict<UpperPattern>;
|
|
11
11
|
};
|
package/dist/dict/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export type Dict<
|
|
2
|
-
export type CallableDict<
|
|
1
|
+
export type Dict<Pattern = RegExp> = readonly (readonly [Pattern, string])[];
|
|
2
|
+
export type CallableDict<Pattern = RegExp> = {
|
|
3
3
|
(value: string): string;
|
|
4
|
-
value: Dict<
|
|
4
|
+
value: Dict<Pattern>;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* Useful if you want to modify the dictionary.
|
|
@@ -9,4 +9,4 @@ export type CallableDict<T = RegExp> = {
|
|
|
9
9
|
* Consider converting it to the type {@link Dict} or {@link CallableDict}
|
|
10
10
|
* if you no longer need to modify it.
|
|
11
11
|
*/
|
|
12
|
-
export type WritableDict<
|
|
12
|
+
export type WritableDict<Pattern = RegExp> = [Pattern, string][];
|
package/dist/dict/wordlist.js
CHANGED
|
@@ -186,7 +186,6 @@ export const wordlist = callableDict([
|
|
|
186
186
|
[/афган/g, 'а(ў|ф)ган'],
|
|
187
187
|
|
|
188
188
|
[/вавілон/g, 'бабілён'],
|
|
189
|
-
[/ бабенберг/g, ' бабэнбэрґ'],
|
|
190
189
|
[/багг(?=[аі])/g, 'баг'],
|
|
191
190
|
[/базілік/g, 'базылік'],
|
|
192
191
|
[/ бакач/g, ' бакачч'],
|
|
@@ -239,6 +238,7 @@ export const wordlist = callableDict([
|
|
|
239
238
|
[/бенін/g, 'бэнін'],
|
|
240
239
|
[/бенедыкт /g, 'бэнэдыкт '],
|
|
241
240
|
[/бэрге(?=лі|ля)/g, 'бер\ue0ffге'], // вёска
|
|
241
|
+
[/ (баб|роз)енберг/g, ' $1энбэрґ'],
|
|
242
242
|
[/берг/g, 'бэрґ'],
|
|
243
243
|
[/ бёрдслі /g, ' бэрдсьлі '],
|
|
244
244
|
[/берклі/g, 'бэрклі'],
|
|
@@ -592,7 +592,6 @@ export const wordlist = callableDict([
|
|
|
592
592
|
[/лантан/g, 'лянтан'],
|
|
593
593
|
[/лапланд/g, 'ляплянд'],
|
|
594
594
|
[/ларынг/g, 'лярынг'],
|
|
595
|
-
[/ларэ(?=н|та)/g, 'лярэ'],
|
|
596
595
|
[/ласьён/g, 'лясьён'],
|
|
597
596
|
[/ залатарэн/g, ' зала\ue0ffтарэн'],
|
|
598
597
|
[/латар(?=[ыэ])/g, 'лятар'],
|
|
@@ -654,6 +653,7 @@ export const wordlist = callableDict([
|
|
|
654
653
|
[/мексі(?=[кц])/g, 'мэксы'],
|
|
655
654
|
[/ мекк/g, ' мэк'], // мэка
|
|
656
655
|
[/мела(?=драм|нізм|ном|рэн|танін|ні[нт]|нхол)/g, 'мэля'],
|
|
656
|
+
[/ларэ(?=н|та)/g, 'лярэ'],
|
|
657
657
|
[/меліяра/g, 'мэліяра'],
|
|
658
658
|
[/мелоды/g, 'мэлёды'],
|
|
659
659
|
[/мелады/g, 'мэляды'],
|
package/dist/lib/debug.d.ts
CHANGED
package/dist/lib/debug.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const prefix = '[debug]';
|
|
2
2
|
export const dict = (dict, regex) => {
|
|
3
3
|
const fn = (text) => fn.value.reduce((acc, item) => {
|
|
4
|
-
if (regex.test(
|
|
5
|
-
console.log(prefix, 'replaceWithDict:', item);
|
|
4
|
+
if (regex.test(acc)) {
|
|
5
|
+
console.log(prefix, 'replaceWithDict:', item, acc);
|
|
6
6
|
process.exit(1);
|
|
7
7
|
}
|
|
8
8
|
return acc.replace(item[0], item[1]);
|
|
@@ -10,7 +10,7 @@ export const dict = (dict, regex) => {
|
|
|
10
10
|
fn.value = dict.value;
|
|
11
11
|
return fn;
|
|
12
12
|
};
|
|
13
|
-
export const
|
|
13
|
+
export const trace = (...msgs) => {
|
|
14
14
|
console.log(prefix, ...msgs);
|
|
15
15
|
return msgs[0];
|
|
16
16
|
};
|
|
@@ -30,13 +30,13 @@ export const highlightDiff = (text, orig, isCyrillic, highlight) => {
|
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
32
|
if (isCyrillic) {
|
|
33
|
-
const
|
|
33
|
+
const noSoftWord = word.replace(/ь/g, '');
|
|
34
34
|
switch (oWord) {
|
|
35
|
-
case
|
|
35
|
+
case noSoftWord:
|
|
36
36
|
text[i] = word.replace(/ь/g, highlight('ь'));
|
|
37
37
|
continue;
|
|
38
|
-
case
|
|
39
|
-
text[i] = word.
|
|
38
|
+
case noSoftWord + 'ь':
|
|
39
|
+
text[i] = word.replace(/ь(?!$)/g, highlight('ь'));
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -18,4 +18,4 @@ import type { TaraskStep } from '@/steps/types';
|
|
|
18
18
|
* );
|
|
19
19
|
* };
|
|
20
20
|
*/
|
|
21
|
-
export declare const mutatingStep: <
|
|
21
|
+
export declare const mutatingStep: <TStorage extends object = object>(callback: (...args: Parameters<TaraskStep<TStorage>>) => string) => TaraskStep<TStorage>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { wordlist } from '../dict/index.js';
|
|
2
2
|
import { endZSoftenAndNiaBiaz, mutatingStep, soften } from '../lib/index.js';
|
|
3
|
-
|
|
3
|
+
import { dict } from '../lib/debug.js';
|
|
4
|
+
export const taraskevize = mutatingStep(({ text }) => endZSoftenAndNiaBiaz(soften(dict(wordlist, /меля/)(text))));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taraskevizer",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.3",
|
|
4
4
|
"author": "GooseOb",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"module": "dist/index.js",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@digitak/esrun": "^3.2.26",
|
|
13
|
-
"@eslint/js": "^9.
|
|
14
|
-
"@types/node": "^20.17.
|
|
15
|
-
"bun-types": "^1.
|
|
16
|
-
"eslint": "^9.
|
|
13
|
+
"@eslint/js": "^9.19.0",
|
|
14
|
+
"@types/node": "^20.17.17",
|
|
15
|
+
"bun-types": "^1.2.2",
|
|
16
|
+
"eslint": "^9.19.0",
|
|
17
17
|
"husky": "^9.1.7",
|
|
18
18
|
"prettier": "^3.4.2",
|
|
19
19
|
"typedoc": "^0.26.11",
|
|
20
20
|
"typescript": "^5.7.3",
|
|
21
|
-
"typescript-eslint": "^8.
|
|
21
|
+
"typescript-eslint": "^8.23.0"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
24
|
"tarask": "dist/bin.js"
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"dev": "esrun --watch=src/*,test/* --send-code-mode=temporaryFile test",
|
|
46
46
|
"dev:bun": "bun test --watch",
|
|
47
47
|
"test": "bun ./test",
|
|
48
|
+
"json": "node ./generate-json.js",
|
|
48
49
|
"test-cli": "bun run build && bun run test",
|
|
49
50
|
"docs": "typedoc"
|
|
50
51
|
},
|
package/LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 GooseOb
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|