taraskevizer 6.1.19 → 7.0.1
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 +25 -32
- package/dist/bin.js +18 -10
- package/dist/index.cjs +417 -232
- package/dist/index.d.ts +186 -32
- package/dist/index.js +409 -229
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
type Dict<T = RegExp> = readonly (readonly [T, string])[];
|
|
2
|
+
type WritableDict<T = RegExp> = [T, string][];
|
|
3
|
+
type RawDict = WritableDict<string | RegExp>;
|
|
2
4
|
|
|
3
5
|
type ModifyObjectType<T, TResultObj> = T extends object ? T extends (...args: any[]) => any ? T : TResultObj : T;
|
|
4
6
|
type DeepPartialReadonly<T> = ModifyObjectType<T, {
|
|
5
7
|
readonly [P in keyof T]?: DeepPartialReadonly<T[P]>;
|
|
6
8
|
}>;
|
|
7
|
-
type Alphabet =
|
|
9
|
+
type Alphabet = {
|
|
10
|
+
lower: Dict;
|
|
11
|
+
upper?: Dict;
|
|
12
|
+
};
|
|
8
13
|
type OptionJ = 0 | 1 | 2;
|
|
9
14
|
type Variation = 0 | 1 | 2;
|
|
10
15
|
type TaraskOptions = {
|
|
@@ -25,6 +30,13 @@ type ExtendedDict = readonly (readonly [
|
|
|
25
30
|
string | ((...substrings: string[]) => string)
|
|
26
31
|
])[];
|
|
27
32
|
|
|
33
|
+
declare const latinLettersLowerCase: (readonly [RegExp, string])[];
|
|
34
|
+
declare const latinLettersUpperCase: (readonly [RegExp, string])[];
|
|
35
|
+
declare const latinLettersLowerCaseJi: (readonly [RegExp, string])[];
|
|
36
|
+
declare const latinLettersUpperCaseJi: (readonly [RegExp, string])[];
|
|
37
|
+
|
|
38
|
+
declare const arabLetters: Dict;
|
|
39
|
+
|
|
28
40
|
declare const gobj: {
|
|
29
41
|
readonly г: "ґ";
|
|
30
42
|
readonly Г: "Ґ";
|
|
@@ -37,7 +49,25 @@ declare const wordlist: (readonly [RegExp, string])[];
|
|
|
37
49
|
declare const noSoften: Dict;
|
|
38
50
|
declare const softeners: Dict;
|
|
39
51
|
|
|
40
|
-
declare
|
|
52
|
+
declare const index$2_arabLetters: typeof arabLetters;
|
|
53
|
+
declare const index$2_gobj: typeof gobj;
|
|
54
|
+
declare const index$2_latinLettersLowerCase: typeof latinLettersLowerCase;
|
|
55
|
+
declare const index$2_latinLettersLowerCaseJi: typeof latinLettersLowerCaseJi;
|
|
56
|
+
declare const index$2_latinLettersUpperCase: typeof latinLettersUpperCase;
|
|
57
|
+
declare const index$2_latinLettersUpperCaseJi: typeof latinLettersUpperCaseJi;
|
|
58
|
+
declare const index$2_noSoften: typeof noSoften;
|
|
59
|
+
declare const index$2_softeners: typeof softeners;
|
|
60
|
+
declare const index$2_wordlist: typeof wordlist;
|
|
61
|
+
declare namespace index$2 {
|
|
62
|
+
export { index$2_arabLetters as arabLetters, index$2_gobj as gobj, index$2_latinLettersLowerCase as latinLettersLowerCase, index$2_latinLettersLowerCaseJi as latinLettersLowerCaseJi, index$2_latinLettersUpperCase as latinLettersUpperCase, index$2_latinLettersUpperCaseJi as latinLettersUpperCaseJi, index$2_noSoften as noSoften, index$2_softeners as softeners, index$2_wordlist as wordlist };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare class TaraskConfig {
|
|
66
|
+
constructor(options?: DeepPartialReadonly<{
|
|
67
|
+
general: TaraskOptions;
|
|
68
|
+
html: HtmlOptions;
|
|
69
|
+
nonHtml: NonHtmlOptions;
|
|
70
|
+
}>);
|
|
41
71
|
general: {
|
|
42
72
|
abc: Alphabet;
|
|
43
73
|
j: OptionJ;
|
|
@@ -51,28 +81,7 @@ declare class Taraskevizer {
|
|
|
51
81
|
ansiColors: boolean;
|
|
52
82
|
variations: Variation;
|
|
53
83
|
};
|
|
54
|
-
private spaces;
|
|
55
|
-
restoreSpaces(text: string): string;
|
|
56
|
-
constructor(options?: DeepPartialReadonly<{
|
|
57
|
-
general: TaraskOptions;
|
|
58
|
-
html: HtmlOptions;
|
|
59
|
-
nonHtml: NonHtmlOptions;
|
|
60
|
-
taraskevize(this: Taraskevizer, text: string): string;
|
|
61
|
-
}>);
|
|
62
|
-
convert(text: string): string;
|
|
63
|
-
convertToHtml(text: string): string;
|
|
64
|
-
private prepare;
|
|
65
|
-
convertAlphabetOnly(text: string): string;
|
|
66
|
-
private process;
|
|
67
|
-
protected taraskevize(text: string): string;
|
|
68
84
|
}
|
|
69
|
-
|
|
70
|
-
declare const ALPHABET: {
|
|
71
|
-
readonly CYRILLIC: 0;
|
|
72
|
-
readonly LATIN: 1;
|
|
73
|
-
readonly ARABIC: 2;
|
|
74
|
-
readonly LATIN_JI: 3;
|
|
75
|
-
};
|
|
76
85
|
declare const REPLACE_J: {
|
|
77
86
|
readonly NEVER: 0;
|
|
78
87
|
readonly RANDOM: 1;
|
|
@@ -84,17 +93,162 @@ declare const VARIATION: {
|
|
|
84
93
|
readonly ALL: 2;
|
|
85
94
|
};
|
|
86
95
|
|
|
87
|
-
|
|
96
|
+
type TaraskStep<Storage = {}> = (text: string, args: {
|
|
97
|
+
storage: Storage;
|
|
98
|
+
cfg: TaraskConfig;
|
|
99
|
+
}) => string;
|
|
100
|
+
type SplittedTextStorage = {
|
|
101
|
+
text: string[];
|
|
102
|
+
orig: readonly string[];
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
declare const convertAlphabet: TaraskStep;
|
|
106
|
+
declare const convertAlphabetLowerCase: TaraskStep;
|
|
107
|
+
|
|
108
|
+
declare const highlightDiffStep: (highlight: (content: string) => string) => TaraskStep<SplittedTextStorage>;
|
|
109
|
+
declare const highlightDiffNonHtmlStep: TaraskStep<SplittedTextStorage>;
|
|
110
|
+
|
|
111
|
+
declare const applyHtmlVariations: TaraskStep;
|
|
112
|
+
declare const applyHtmlG: TaraskStep;
|
|
113
|
+
|
|
114
|
+
declare const replaceIbyJ: TaraskStep;
|
|
115
|
+
|
|
116
|
+
declare const joinSplittedText: TaraskStep<SplittedTextStorage>;
|
|
117
|
+
|
|
118
|
+
declare const applyNonHtmlVariations: TaraskStep;
|
|
119
|
+
declare const applyNonHtmlG: TaraskStep;
|
|
120
|
+
|
|
121
|
+
declare const prepare: TaraskStep;
|
|
122
|
+
|
|
123
|
+
declare const applyNoFix: TaraskStep<SpecialSyntaxStorage>;
|
|
124
|
+
declare const applyVariableParts: (callback: (arr: string[]) => string) => TaraskStep;
|
|
125
|
+
type SpecialSyntaxStorage = {
|
|
126
|
+
noFixArr: string[];
|
|
127
|
+
};
|
|
128
|
+
declare const resolveSpecialSyntax: (leftAngleBracket: string) => TaraskStep<SpecialSyntaxStorage>;
|
|
129
|
+
|
|
130
|
+
declare const restoreCaseStep: TaraskStep<SplittedTextStorage>;
|
|
131
|
+
|
|
132
|
+
declare const storeSplittedAbcConvertedOrig: TaraskStep<SplittedTextStorage>;
|
|
133
|
+
|
|
134
|
+
declare const storeSplittedText: TaraskStep<SplittedTextStorage>;
|
|
135
|
+
|
|
136
|
+
declare const taraskevize: TaraskStep;
|
|
137
|
+
|
|
138
|
+
type WhiteSpaceStorage = {
|
|
139
|
+
spaces: string[];
|
|
140
|
+
positions: number[];
|
|
141
|
+
};
|
|
142
|
+
declare const whitespacesToSpaces: TaraskStep<WhiteSpaceStorage>;
|
|
143
|
+
declare const restoreWhitespaces: TaraskStep<WhiteSpaceStorage>;
|
|
144
|
+
|
|
145
|
+
declare const trim: TaraskStep;
|
|
146
|
+
|
|
147
|
+
type index$1_SplittedTextStorage = SplittedTextStorage;
|
|
148
|
+
type index$1_TaraskStep<Storage = {}> = TaraskStep<Storage>;
|
|
149
|
+
declare const index$1_applyHtmlG: typeof applyHtmlG;
|
|
150
|
+
declare const index$1_applyHtmlVariations: typeof applyHtmlVariations;
|
|
151
|
+
declare const index$1_applyNoFix: typeof applyNoFix;
|
|
152
|
+
declare const index$1_applyNonHtmlG: typeof applyNonHtmlG;
|
|
153
|
+
declare const index$1_applyNonHtmlVariations: typeof applyNonHtmlVariations;
|
|
154
|
+
declare const index$1_applyVariableParts: typeof applyVariableParts;
|
|
155
|
+
declare const index$1_convertAlphabet: typeof convertAlphabet;
|
|
156
|
+
declare const index$1_convertAlphabetLowerCase: typeof convertAlphabetLowerCase;
|
|
157
|
+
declare const index$1_highlightDiffNonHtmlStep: typeof highlightDiffNonHtmlStep;
|
|
158
|
+
declare const index$1_highlightDiffStep: typeof highlightDiffStep;
|
|
159
|
+
declare const index$1_joinSplittedText: typeof joinSplittedText;
|
|
160
|
+
declare const index$1_prepare: typeof prepare;
|
|
161
|
+
declare const index$1_replaceIbyJ: typeof replaceIbyJ;
|
|
162
|
+
declare const index$1_resolveSpecialSyntax: typeof resolveSpecialSyntax;
|
|
163
|
+
declare const index$1_restoreCaseStep: typeof restoreCaseStep;
|
|
164
|
+
declare const index$1_restoreWhitespaces: typeof restoreWhitespaces;
|
|
165
|
+
declare const index$1_storeSplittedAbcConvertedOrig: typeof storeSplittedAbcConvertedOrig;
|
|
166
|
+
declare const index$1_storeSplittedText: typeof storeSplittedText;
|
|
167
|
+
declare const index$1_taraskevize: typeof taraskevize;
|
|
168
|
+
declare const index$1_trim: typeof trim;
|
|
169
|
+
declare const index$1_whitespacesToSpaces: typeof whitespacesToSpaces;
|
|
170
|
+
declare namespace index$1 {
|
|
171
|
+
export { type index$1_SplittedTextStorage as SplittedTextStorage, type index$1_TaraskStep as TaraskStep, index$1_applyHtmlG as applyHtmlG, index$1_applyHtmlVariations as applyHtmlVariations, index$1_applyNoFix as applyNoFix, index$1_applyNonHtmlG as applyNonHtmlG, index$1_applyNonHtmlVariations as applyNonHtmlVariations, index$1_applyVariableParts as applyVariableParts, index$1_convertAlphabet as convertAlphabet, index$1_convertAlphabetLowerCase as convertAlphabetLowerCase, index$1_highlightDiffNonHtmlStep as highlightDiffNonHtmlStep, index$1_highlightDiffStep as highlightDiffStep, index$1_joinSplittedText as joinSplittedText, index$1_prepare as prepare, index$1_replaceIbyJ as replaceIbyJ, index$1_resolveSpecialSyntax as resolveSpecialSyntax, index$1_restoreCaseStep as restoreCaseStep, index$1_restoreWhitespaces as restoreWhitespaces, index$1_storeSplittedAbcConvertedOrig as storeSplittedAbcConvertedOrig, index$1_storeSplittedText as storeSplittedText, index$1_taraskevize as taraskevize, index$1_trim as trim, index$1_whitespacesToSpaces as whitespacesToSpaces };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
declare const tarask: (text: string, pipeline: TaraskStep<any>[], cfg?: TaraskConfig) => string;
|
|
175
|
+
|
|
176
|
+
declare const ALPHABET: {
|
|
177
|
+
LATIN: {
|
|
178
|
+
lower: (readonly [RegExp, string])[];
|
|
179
|
+
upper: (readonly [RegExp, string])[];
|
|
180
|
+
};
|
|
181
|
+
LATIN_JI: {
|
|
182
|
+
lower: (readonly [RegExp, string])[];
|
|
183
|
+
upper: (readonly [RegExp, string])[];
|
|
184
|
+
};
|
|
185
|
+
ARABIC: {
|
|
186
|
+
lower: Dict;
|
|
187
|
+
};
|
|
188
|
+
CYRILLIC: {
|
|
189
|
+
lower: never[];
|
|
190
|
+
upper: never[];
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
declare const abcOnlyPipeline: (TaraskStep<{
|
|
195
|
+
noFixArr: string[];
|
|
196
|
+
}> | TaraskStep<{
|
|
197
|
+
spaces: string[];
|
|
198
|
+
positions: number[];
|
|
199
|
+
}> | ((_: string, { storage, cfg: { general } }: {
|
|
200
|
+
storage: {
|
|
201
|
+
doEscapeCapitalized: boolean;
|
|
202
|
+
};
|
|
203
|
+
cfg: TaraskConfig;
|
|
204
|
+
}) => string))[];
|
|
205
|
+
declare const plainTextPipeline: (TaraskStep<SplittedTextStorage> | TaraskStep<{
|
|
206
|
+
noFixArr: string[];
|
|
207
|
+
}> | TaraskStep<{
|
|
208
|
+
spaces: string[];
|
|
209
|
+
positions: number[];
|
|
210
|
+
}>)[];
|
|
211
|
+
declare const htmlPipeline: (TaraskStep<SplittedTextStorage> | TaraskStep<{
|
|
212
|
+
noFixArr: string[];
|
|
213
|
+
}> | TaraskStep<{
|
|
214
|
+
spaces: string[];
|
|
215
|
+
positions: number[];
|
|
216
|
+
}>)[];
|
|
88
217
|
|
|
89
218
|
declare const afterTarask: ExtendedDict;
|
|
90
219
|
|
|
91
|
-
declare const
|
|
92
|
-
|
|
93
|
-
declare const
|
|
94
|
-
|
|
95
|
-
declare const
|
|
96
|
-
|
|
97
|
-
|
|
220
|
+
declare const highlightDiff: (text: string[], orig: readonly string[], isCyrillic: boolean, highlight: (content: string) => string) => void;
|
|
221
|
+
|
|
222
|
+
declare const replaceG: (replacer: string | ((g: 'Ґ' | 'ґ') => string)) => (text: string) => string;
|
|
223
|
+
|
|
224
|
+
declare const replaceWithDict: (text: string, dict?: ExtendedDict) => string;
|
|
225
|
+
|
|
226
|
+
declare const restoreCase: (text: string[], orig: readonly string[]) => string[];
|
|
227
|
+
|
|
228
|
+
declare const htmlWrappers: {
|
|
229
|
+
fix: (content: string) => string;
|
|
230
|
+
letterH: (content: string) => string;
|
|
231
|
+
};
|
|
232
|
+
declare const ansiColorWrappers: {
|
|
233
|
+
fix: (content: string) => string;
|
|
234
|
+
variable: (content: string) => string;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
declare const dictFrom: {
|
|
238
|
+
raw: (dict: RawDict) => Dict;
|
|
239
|
+
nonGlobal: (dict: WritableDict) => Dict;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
declare const index_afterTarask: typeof afterTarask;
|
|
243
|
+
declare const index_ansiColorWrappers: typeof ansiColorWrappers;
|
|
244
|
+
declare const index_dictFrom: typeof dictFrom;
|
|
245
|
+
declare const index_highlightDiff: typeof highlightDiff;
|
|
246
|
+
declare const index_htmlWrappers: typeof htmlWrappers;
|
|
247
|
+
declare const index_replaceG: typeof replaceG;
|
|
248
|
+
declare const index_replaceWithDict: typeof replaceWithDict;
|
|
249
|
+
declare const index_restoreCase: typeof restoreCase;
|
|
250
|
+
declare namespace index {
|
|
251
|
+
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 };
|
|
98
252
|
}
|
|
99
253
|
|
|
100
|
-
export { ALPHABET, type HtmlOptions, type NonHtmlOptions, REPLACE_J, type TaraskOptions,
|
|
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 };
|