taraskevizer 2.0.3 → 2.1.0
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 +107 -0
- package/dist/index.cjs +22 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -21
- package/package.json +8 -9
- package/bin/index.js +0 -121
- package/dist/index.d.cts +0 -59
package/dist/bin.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { tarask, taraskToHtml } from "./index.js";
|
|
3
|
+
import { readFile } from "fs/promises";
|
|
4
|
+
const printWithPrefix = (msg) => {
|
|
5
|
+
process.stdout.write(
|
|
6
|
+
"\x1B[34m[taraskevizer]\x1B[0m " + msg.toString() + "\n"
|
|
7
|
+
);
|
|
8
|
+
};
|
|
9
|
+
process.argv.splice(0, 2);
|
|
10
|
+
const checkForOptions = (options) => options.includes(process.argv[0].toLowerCase());
|
|
11
|
+
if (checkForOptions(["-v", "--version"])) {
|
|
12
|
+
const { version } = JSON.parse(
|
|
13
|
+
await readFile(new URL("../package.json", import.meta.url), "utf8")
|
|
14
|
+
);
|
|
15
|
+
printWithPrefix(version);
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
const taraskOptions = {};
|
|
19
|
+
const nonHtmlOptions = {
|
|
20
|
+
variations: 2,
|
|
21
|
+
nodeColors: true
|
|
22
|
+
};
|
|
23
|
+
const htmlOptions = { g: true };
|
|
24
|
+
let isHtml = false;
|
|
25
|
+
const toHashTable = (dict) => {
|
|
26
|
+
const result = {};
|
|
27
|
+
for (const [options, callback] of dict)
|
|
28
|
+
for (const option of options)
|
|
29
|
+
result[option] = callback;
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
const optionDict = toHashTable([
|
|
33
|
+
[
|
|
34
|
+
["--latin", "-l"],
|
|
35
|
+
() => {
|
|
36
|
+
taraskOptions.abc = 1;
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
["--arabic", "-a"],
|
|
41
|
+
() => {
|
|
42
|
+
taraskOptions.abc = 2;
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
["--greek", "-gr"],
|
|
47
|
+
() => {
|
|
48
|
+
taraskOptions.abc = 3;
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
["--jrandom", "-jr"],
|
|
53
|
+
() => {
|
|
54
|
+
taraskOptions.j = 1;
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
["--jalways", "-ja"],
|
|
59
|
+
() => {
|
|
60
|
+
taraskOptions.j = 2;
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
["--h", "-h"],
|
|
65
|
+
() => {
|
|
66
|
+
nonHtmlOptions.h = true;
|
|
67
|
+
htmlOptions.g = false;
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
["--no-variations", "-nv"],
|
|
72
|
+
() => {
|
|
73
|
+
nonHtmlOptions.variations = 0;
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
["--first-variation-only", "-fvo"],
|
|
78
|
+
() => {
|
|
79
|
+
nonHtmlOptions.variations = 1;
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
["--no-color", "-nc"],
|
|
84
|
+
() => {
|
|
85
|
+
nonHtmlOptions.nodeColors = false;
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
["--html", "-html"],
|
|
90
|
+
() => {
|
|
91
|
+
isHtml = true;
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
]);
|
|
95
|
+
let currOption;
|
|
96
|
+
while (currOption = process.argv.shift()) {
|
|
97
|
+
if (currOption in optionDict) {
|
|
98
|
+
optionDict[currOption]();
|
|
99
|
+
} else {
|
|
100
|
+
process.argv.unshift(currOption);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const text = process.argv.join(" ");
|
|
105
|
+
process.stdout.write(
|
|
106
|
+
isHtml ? taraskToHtml(text, taraskOptions, htmlOptions) : tarask(text, taraskOptions, nonHtmlOptions)
|
|
107
|
+
);
|
package/dist/index.cjs
CHANGED
|
@@ -31,10 +31,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
31
31
|
|
|
32
32
|
// src/dict/latin.ts
|
|
33
33
|
var latinLetters = [
|
|
34
|
-
[/(?<=[
|
|
35
|
-
[/(?<=[
|
|
36
|
-
[/(?<=[
|
|
37
|
-
[/(?<=[
|
|
34
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)е/, "je"],
|
|
35
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)ё/, "jo"],
|
|
36
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)ю/, "ju"],
|
|
37
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)я/, "ja"],
|
|
38
|
+
[/ʼі/, "ji"],
|
|
38
39
|
[/ʼ/, ""],
|
|
39
40
|
[/ць/, "ć"],
|
|
40
41
|
[/зь/, "ź"],
|
|
@@ -77,14 +78,14 @@ var latinLetters = [
|
|
|
77
78
|
[/łi/, "li"]
|
|
78
79
|
];
|
|
79
80
|
var latinLettersUpperCase = [
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[/(?<=[
|
|
85
|
-
[/(?<=[
|
|
86
|
-
[/(?<=[
|
|
87
|
-
[/(?<=[
|
|
81
|
+
[new RegExp(" Е(?= *\\p{Ll})", "u"), " Je"],
|
|
82
|
+
[new RegExp(" Ё(?= *\\p{Ll})", "u"), " Jo"],
|
|
83
|
+
[new RegExp(" Ю(?= *\\p{Ll})", "u"), " Ju"],
|
|
84
|
+
[new RegExp(" Я(?= *\\p{Ll})", "u"), " Ja"],
|
|
85
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Е/, "JE"],
|
|
86
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Ё/, "JO"],
|
|
87
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Ю/, "JU"],
|
|
88
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Я/, "JA"],
|
|
88
89
|
[/Е/, "IE"],
|
|
89
90
|
[/Ё/, "IO"],
|
|
90
91
|
[/Ю/, "IU"],
|
|
@@ -168,12 +169,12 @@ var greekLetters = [
|
|
|
168
169
|
[/ь/, "’"]
|
|
169
170
|
];
|
|
170
171
|
var greekLettersUpperCase = [
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
172
|
+
[new RegExp(" Б(?= *\\p{Ll})", "u"), " Μπ"],
|
|
173
|
+
[new RegExp(" Ґ(?= *\\p{Ll})", "u"), " Γκ"],
|
|
174
|
+
[new RegExp(" Ё(?= *\\p{Ll})", "u"), " Υο"],
|
|
175
|
+
[new RegExp(" Ю(?= *\\p{Ll})", "u"), " Υϋ"],
|
|
176
|
+
[new RegExp(" Я(?= *\\p{Ll})", "u"), " Υα"],
|
|
177
|
+
[new RegExp(" Ч(?= *\\p{Ll})", "u"), " Τσ̌"],
|
|
177
178
|
[/Б/, "ΜΠ"],
|
|
178
179
|
[/Ґ/, "ΓΚ"],
|
|
179
180
|
[/Ё/, "ΥΟ"],
|
|
@@ -2131,7 +2132,7 @@ for (const word of gwords)
|
|
|
2131
2132
|
var isUpperCase = (str) => str === str.toUpperCase();
|
|
2132
2133
|
var getLastLetter = (word, i) => {
|
|
2133
2134
|
for (let i2 = word.length - 1; i2 >= 0; i2--)
|
|
2134
|
-
if (
|
|
2135
|
+
if (new RegExp("\\p{L}", "u").test(word[i2]))
|
|
2135
2136
|
return word[i2];
|
|
2136
2137
|
throw new Error(`the last letter of the word ${word} not found. index: ${i}`);
|
|
2137
2138
|
};
|
|
@@ -2185,7 +2186,7 @@ var process = (text, LEFT_ANGLE_BRACKET, options) => {
|
|
|
2185
2186
|
return LEFT_ANGLE_BRACKET + $2 + ">";
|
|
2186
2187
|
noFix2[noFix2.length] = $1 === "." ? $2 : $0;
|
|
2187
2188
|
return NOFIX_CHAR;
|
|
2188
|
-
}).replace(/г'(?![еёіюя])/g, "ґ").replace(/([\n\t])/g, " $1 ").replace(/ - /g, " — ").replace(
|
|
2189
|
+
}).replace(/г'(?![еёіюя])/g, "ґ").replace(/([\n\t])/g, " $1 ").replace(/ - /g, " — ").replace(new RegExp("(\\p{P}|\\p{S}|\\d)", "gu"), " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "(");
|
|
2189
2190
|
let splittedOrig, splitted;
|
|
2190
2191
|
splittedOrig = replaceWithDict(
|
|
2191
2192
|
replaceWithDict(text, letters[abc]),
|
|
@@ -2214,7 +2215,7 @@ var applyNoFix = (text) => {
|
|
|
2214
2215
|
noFix = [];
|
|
2215
2216
|
return text;
|
|
2216
2217
|
};
|
|
2217
|
-
var join = (textArr) => textArr.join(" ").replace(/ /g, " ").replace(
|
|
2218
|
+
var join = (textArr) => textArr.join(" ").replace(/ /g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d|() ", "gu"), "$1");
|
|
2218
2219
|
var finilize = (text, newLine) => text.replace(/ \t /g, " ").replace(/ \n /g, newLine).trim();
|
|
2219
2220
|
var replaceG = (text, replacer) => text.replace(
|
|
2220
2221
|
G_REGEX,
|
package/dist/index.d.ts
CHANGED
|
@@ -56,4 +56,4 @@ declare const gobj: {
|
|
|
56
56
|
readonly Ґ: "Г";
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
export { ALPHABET, AlphabetDependentDict, DeepPartialReadonly, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask, TaraskOptions, ToTarask, VARIATION, gobj, tarask, taraskToHtml };
|
|
59
|
+
export { ALPHABET, type AlphabetDependentDict, type DeepPartialReadonly, type Dict, type ExtendedDict, type HtmlOptions, J, type NonHtmlOptions, type ReplaceWithDict, type Tarask, type TaraskOptions, type ToTarask, VARIATION, gobj, tarask, taraskToHtml };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/dict/latin.ts
|
|
2
2
|
var latinLetters = [
|
|
3
|
-
[/(?<=[
|
|
4
|
-
[/(?<=[
|
|
5
|
-
[/(?<=[
|
|
6
|
-
[/(?<=[
|
|
3
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)е/, "je"],
|
|
4
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)ё/, "jo"],
|
|
5
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)ю/, "ju"],
|
|
6
|
+
[/(?<=[аеёіоуўыэюяьʼ| ]\(?)я/, "ja"],
|
|
7
|
+
[/ʼі/, "ji"],
|
|
7
8
|
[/ʼ/, ""],
|
|
8
9
|
[/ць/, "ć"],
|
|
9
10
|
[/зь/, "ź"],
|
|
@@ -46,14 +47,14 @@ var latinLetters = [
|
|
|
46
47
|
[/łi/, "li"]
|
|
47
48
|
];
|
|
48
49
|
var latinLettersUpperCase = [
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[/(?<=[
|
|
54
|
-
[/(?<=[
|
|
55
|
-
[/(?<=[
|
|
56
|
-
[/(?<=[
|
|
50
|
+
[new RegExp(" Е(?= *\\p{Ll})", "u"), " Je"],
|
|
51
|
+
[new RegExp(" Ё(?= *\\p{Ll})", "u"), " Jo"],
|
|
52
|
+
[new RegExp(" Ю(?= *\\p{Ll})", "u"), " Ju"],
|
|
53
|
+
[new RegExp(" Я(?= *\\p{Ll})", "u"), " Ja"],
|
|
54
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Е/, "JE"],
|
|
55
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Ё/, "JO"],
|
|
56
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Ю/, "JU"],
|
|
57
|
+
[/(?<=[АЕЁІОУЎЫЭЮЯЬʼ| ]\(?)Я/, "JA"],
|
|
57
58
|
[/Е/, "IE"],
|
|
58
59
|
[/Ё/, "IO"],
|
|
59
60
|
[/Ю/, "IU"],
|
|
@@ -137,12 +138,12 @@ var greekLetters = [
|
|
|
137
138
|
[/ь/, "’"]
|
|
138
139
|
];
|
|
139
140
|
var greekLettersUpperCase = [
|
|
140
|
-
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
143
|
-
[
|
|
144
|
-
[
|
|
145
|
-
[
|
|
141
|
+
[new RegExp(" Б(?= *\\p{Ll})", "u"), " Μπ"],
|
|
142
|
+
[new RegExp(" Ґ(?= *\\p{Ll})", "u"), " Γκ"],
|
|
143
|
+
[new RegExp(" Ё(?= *\\p{Ll})", "u"), " Υο"],
|
|
144
|
+
[new RegExp(" Ю(?= *\\p{Ll})", "u"), " Υϋ"],
|
|
145
|
+
[new RegExp(" Я(?= *\\p{Ll})", "u"), " Υα"],
|
|
146
|
+
[new RegExp(" Ч(?= *\\p{Ll})", "u"), " Τσ̌"],
|
|
146
147
|
[/Б/, "ΜΠ"],
|
|
147
148
|
[/Ґ/, "ΓΚ"],
|
|
148
149
|
[/Ё/, "ΥΟ"],
|
|
@@ -2100,7 +2101,7 @@ for (const word of gwords)
|
|
|
2100
2101
|
var isUpperCase = (str) => str === str.toUpperCase();
|
|
2101
2102
|
var getLastLetter = (word, i) => {
|
|
2102
2103
|
for (let i2 = word.length - 1; i2 >= 0; i2--)
|
|
2103
|
-
if (
|
|
2104
|
+
if (new RegExp("\\p{L}", "u").test(word[i2]))
|
|
2104
2105
|
return word[i2];
|
|
2105
2106
|
throw new Error(`the last letter of the word ${word} not found. index: ${i}`);
|
|
2106
2107
|
};
|
|
@@ -2154,7 +2155,7 @@ var process = (text, LEFT_ANGLE_BRACKET, options) => {
|
|
|
2154
2155
|
return LEFT_ANGLE_BRACKET + $2 + ">";
|
|
2155
2156
|
noFix2[noFix2.length] = $1 === "." ? $2 : $0;
|
|
2156
2157
|
return NOFIX_CHAR;
|
|
2157
|
-
}).replace(/г'(?![еёіюя])/g, "ґ").replace(/([\n\t])/g, " $1 ").replace(/ - /g, " — ").replace(
|
|
2158
|
+
}).replace(/г'(?![еёіюя])/g, "ґ").replace(/([\n\t])/g, " $1 ").replace(/ - /g, " — ").replace(new RegExp("(\\p{P}|\\p{S}|\\d)", "gu"), " $1 ").replace(/ ['`’] (?=\S)/g, "ʼ").replace(/\(/g, "(");
|
|
2158
2159
|
let splittedOrig, splitted;
|
|
2159
2160
|
splittedOrig = replaceWithDict(
|
|
2160
2161
|
replaceWithDict(text, letters[abc]),
|
|
@@ -2183,7 +2184,7 @@ var applyNoFix = (text) => {
|
|
|
2183
2184
|
noFix = [];
|
|
2184
2185
|
return text;
|
|
2185
2186
|
};
|
|
2186
|
-
var join = (textArr) => textArr.join(" ").replace(/ /g, " ").replace(
|
|
2187
|
+
var join = (textArr) => textArr.join(" ").replace(/ /g, " ").replace(new RegExp(" (\\p{P}|\\p{S}|\\d|() ", "gu"), "$1");
|
|
2187
2188
|
var finilize = (text, newLine) => text.replace(/ \t /g, " ").replace(/ \n /g, newLine).trim();
|
|
2188
2189
|
var replaceG = (text, replacer) => text.replace(
|
|
2189
2190
|
G_REGEX,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "taraskevizer",
|
|
3
3
|
"author": "GooseOb",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "2.0
|
|
5
|
+
"version": "2.1.0",
|
|
6
6
|
"private": false,
|
|
7
7
|
"homepage": "https://gooseob.github.io/taraskevizatar/",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"bin": {
|
|
13
|
-
"tarask": "bin
|
|
13
|
+
"tarask": "dist/bin.js"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist/**/*",
|
|
17
|
-
"bin/**/*",
|
|
18
17
|
"README.md"
|
|
19
18
|
],
|
|
20
19
|
"scripts": {
|
|
@@ -39,13 +38,13 @@
|
|
|
39
38
|
"belarusian"
|
|
40
39
|
],
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@digitak/esrun": "^3.2.
|
|
43
|
-
"@types/node": "^20.
|
|
44
|
-
"bun-types": "^1.0.
|
|
41
|
+
"@digitak/esrun": "^3.2.25",
|
|
42
|
+
"@types/node": "^20.10.4",
|
|
43
|
+
"bun-types": "^1.0.17",
|
|
45
44
|
"husky": "^8.0.3",
|
|
46
|
-
"prettier": "^3.
|
|
47
|
-
"simple-git": "^3.
|
|
45
|
+
"prettier": "^3.1.1",
|
|
46
|
+
"simple-git": "^3.21.0",
|
|
48
47
|
"tsup": "^7.2.0",
|
|
49
|
-
"typescript": "^5.
|
|
48
|
+
"typescript": "^5.3.3"
|
|
50
49
|
}
|
|
51
50
|
}
|
package/bin/index.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { tarask, taraskToHtml } from '../dist/index.js';
|
|
3
|
-
import { readFile } from 'fs/promises';
|
|
4
|
-
|
|
5
|
-
const printWithPrefix = (msg) => {
|
|
6
|
-
process.stdout.write(
|
|
7
|
-
'\x1b[34m[taraskevizer]\x1b[0m ' + msg.toString() + '\n'
|
|
8
|
-
);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
process.argv.splice(0, 2);
|
|
12
|
-
|
|
13
|
-
const checkForOptions = (options) =>
|
|
14
|
-
options.includes(process.argv[0].toLowerCase());
|
|
15
|
-
|
|
16
|
-
if (checkForOptions(['-v', '--version'])) {
|
|
17
|
-
const { version } = JSON.parse(
|
|
18
|
-
await readFile(new URL('../package.json', import.meta.url), 'utf8')
|
|
19
|
-
);
|
|
20
|
-
printWithPrefix(version);
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** @type {Partial<import('../dist/types.js').TaraskOptions>} */
|
|
25
|
-
const taraskOptions = {};
|
|
26
|
-
/** @type {Partial<import('../dist/types.js').NonHtmlOptions>} */
|
|
27
|
-
const nonHtmlOptions = { variations: 2, nodeColors: true };
|
|
28
|
-
/** @type {Partial<import('../dist/types.js').HtmlOptions>} */
|
|
29
|
-
const htmlOptions = { g: true };
|
|
30
|
-
|
|
31
|
-
let isHtml = false;
|
|
32
|
-
|
|
33
|
-
const toHashTable = (dict) => {
|
|
34
|
-
const result = {};
|
|
35
|
-
for (const [options, callback] of dict)
|
|
36
|
-
for (const option of options) result[option] = callback;
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const optionDict = toHashTable([
|
|
41
|
-
[
|
|
42
|
-
['--latin', '-l'],
|
|
43
|
-
() => {
|
|
44
|
-
taraskOptions.abc = 1;
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
[
|
|
48
|
-
['--arabic', '-a'],
|
|
49
|
-
() => {
|
|
50
|
-
taraskOptions.abc = 2;
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
[
|
|
54
|
-
['--greek', '-gr'],
|
|
55
|
-
() => {
|
|
56
|
-
taraskOptions.abc = 3;
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
[
|
|
60
|
-
['--jrandom', '-jr'],
|
|
61
|
-
() => {
|
|
62
|
-
taraskOptions.j = 1;
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
[
|
|
66
|
-
['--jalways', '-ja'],
|
|
67
|
-
() => {
|
|
68
|
-
taraskOptions.j = 2;
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
[
|
|
72
|
-
['--h', '-h'],
|
|
73
|
-
() => {
|
|
74
|
-
nonHtmlOptions.h = true;
|
|
75
|
-
htmlOptions.g = false;
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
['--no-variations', '-nv'],
|
|
80
|
-
() => {
|
|
81
|
-
nonHtmlOptions.variations = 0;
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
['--first-variation-only', '-fvo'],
|
|
86
|
-
() => {
|
|
87
|
-
nonHtmlOptions.variations = 1;
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
[
|
|
91
|
-
['--no-color', '-nc'],
|
|
92
|
-
() => {
|
|
93
|
-
nonHtmlOptions.nodeColors = false;
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
[
|
|
97
|
-
['--html', '-html'],
|
|
98
|
-
() => {
|
|
99
|
-
isHtml = true;
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
]);
|
|
103
|
-
|
|
104
|
-
let currOption;
|
|
105
|
-
|
|
106
|
-
while ((currOption = process.argv.shift())) {
|
|
107
|
-
if (currOption in optionDict) {
|
|
108
|
-
optionDict[currOption]();
|
|
109
|
-
} else {
|
|
110
|
-
process.argv.unshift(currOption);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const text = process.argv.join(' ');
|
|
116
|
-
|
|
117
|
-
process.stdout.write(
|
|
118
|
-
isHtml
|
|
119
|
-
? taraskToHtml(text, taraskOptions, htmlOptions)
|
|
120
|
-
: tarask(text, taraskOptions, nonHtmlOptions)
|
|
121
|
-
);
|
package/dist/index.d.cts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
type ModifyObjectType<T, TResultObj> = T extends object ? T extends (...args: any[]) => any ? T : TResultObj : T;
|
|
2
|
-
type DeepPartialReadonly<T> = ModifyObjectType<T, {
|
|
3
|
-
readonly [P in keyof T]?: DeepPartialReadonly<T[P]>;
|
|
4
|
-
}>;
|
|
5
|
-
type Alphabet = 0 | 1 | 2 | 3;
|
|
6
|
-
type OptionJ = 0 | 1 | 2;
|
|
7
|
-
type Variation = 0 | 1 | 2;
|
|
8
|
-
type TaraskOptions = {
|
|
9
|
-
abc: Alphabet;
|
|
10
|
-
j: OptionJ;
|
|
11
|
-
OVERRIDE_toTarask?: ToTarask;
|
|
12
|
-
};
|
|
13
|
-
type NonHtmlOptions = {
|
|
14
|
-
nodeColors: boolean;
|
|
15
|
-
h: boolean;
|
|
16
|
-
variations: Variation;
|
|
17
|
-
};
|
|
18
|
-
type HtmlOptions = {
|
|
19
|
-
g: boolean;
|
|
20
|
-
};
|
|
21
|
-
type ReplaceWithDict = (text: string, dict?: ExtendedDict) => string;
|
|
22
|
-
type ToTarask = (text: string, replaceWithDict: ReplaceWithDict, wordlist: Dict, softers: Dict, afterTarask: ExtendedDict) => string;
|
|
23
|
-
type Tarask<TOptions extends object> = (text: string, taraskOptions?: DeepPartialReadonly<TaraskOptions>, options?: DeepPartialReadonly<TOptions>) => string;
|
|
24
|
-
type Dict<T = RegExp> = [T, string][];
|
|
25
|
-
type ExtendedDict = [
|
|
26
|
-
RegExp,
|
|
27
|
-
string | ((...substrings: string[]) => string)
|
|
28
|
-
][];
|
|
29
|
-
type AlphabetDependentDict = {
|
|
30
|
-
[key in Alphabet]?: Dict;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
declare const ALPHABET: {
|
|
34
|
-
readonly CYRILLIC: 0;
|
|
35
|
-
readonly LATIN: 1;
|
|
36
|
-
readonly ARABIC: 2;
|
|
37
|
-
readonly GREEK: 3;
|
|
38
|
-
};
|
|
39
|
-
declare const J: {
|
|
40
|
-
readonly NEVER: 0;
|
|
41
|
-
readonly RANDOM: 1;
|
|
42
|
-
readonly ALWAYS: 2;
|
|
43
|
-
};
|
|
44
|
-
declare const VARIATION: {
|
|
45
|
-
readonly NO: 0;
|
|
46
|
-
readonly FIRST: 1;
|
|
47
|
-
readonly ALL: 2;
|
|
48
|
-
};
|
|
49
|
-
declare const taraskToHtml: Tarask<HtmlOptions>;
|
|
50
|
-
declare const tarask: Tarask<NonHtmlOptions>;
|
|
51
|
-
|
|
52
|
-
declare const gobj: {
|
|
53
|
-
readonly г: "ґ";
|
|
54
|
-
readonly Г: "Ґ";
|
|
55
|
-
readonly ґ: "г";
|
|
56
|
-
readonly Ґ: "Г";
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export { ALPHABET, AlphabetDependentDict, DeepPartialReadonly, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask, TaraskOptions, ToTarask, VARIATION, gobj, tarask, taraskToHtml };
|