taraskevizer 1.5.0 → 1.5.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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
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.
package/README.md CHANGED
@@ -132,10 +132,13 @@ Type:
132
132
  ```
133
133
  (
134
134
  text: string,
135
- replaceWithDict: (text: string, dict?: ExtendedDict) => string,
135
+ replaceWithDict: (
136
+ text: string,
137
+ dict?: [RegExp, string | ((...substrings: string[]) => string)][]
138
+ ) => string,
136
139
  wordlist: [RegExp, string][],
137
140
  softers: [RegExp, string][],
138
- afterTarask: [RegExp, string | ((...substrings: string[]) => string)][]
141
+ afterTarask: (text: string) => string
139
142
  ) => string
140
143
  ```
141
144
 
package/dist/index.cjs CHANGED
@@ -549,6 +549,7 @@ var rawWordlist = [
549
549
  [/беразіном /, "(беразіном|бярэзаньню) "],
550
550
  [/ бягомль/, " (бягомель|бегамля)"],
551
551
  /* В */
552
+ [/ вайбер/, " вайбэр"],
552
553
  [/вейшнор/, "вайшнор"],
553
554
  [/валанцёр/, "валянтэр"],
554
555
  [/ валон/, " валён"],
@@ -1340,6 +1341,7 @@ var rawWordlist = [
1340
1341
  [/эмансіп/, "эмансып"],
1341
1342
  [/ эпапе/, " эпапэ"],
1342
1343
  [/епарх/, "эпарх"],
1344
+ [/ эскала/, " эскаля"],
1343
1345
  [/эсперант/, "эспэрант"],
1344
1346
  [/эстафет/, "эстафэт"],
1345
1347
  [/ еў(?=р(?:а|о|ыпід)|патор|фра|фроні|харысты)/, " эў"],
@@ -2156,7 +2158,7 @@ var taraskSync = (text, options = {}) => {
2156
2158
  const isHtmlObject = isObject(html);
2157
2159
  const isNonHtmlObject = isObject(nonHtml);
2158
2160
  if (isNonHtmlObject) {
2159
- nonHtml.variations || (nonHtml.variations = 0);
2161
+ nonHtml.variations ||= 0;
2160
2162
  }
2161
2163
  const apply = html ? tagApplications.html : tagApplications.nonHtml;
2162
2164
  const noFix = [];
@@ -0,0 +1,64 @@
1
+ type Promisify<T> = T extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => Promise<TReturn> : never;
2
+ type AnyFn = (...args: any[]) => any;
3
+ type DeepPartial<T> = T extends object ? T extends AnyFn ? T : {
4
+ [P in keyof T]?: DeepPartial<T[P]>;
5
+ } : T;
6
+ type Alphabet = 0 | 1 | 2 | 3;
7
+ type OptionJ = 0 | 1 | 2;
8
+ type Variation = 0 | 1 | 2;
9
+ type NonHtmlOptions = {
10
+ nodeColors: boolean;
11
+ h: boolean;
12
+ variations: Variation;
13
+ };
14
+ type HtmlOptions = {
15
+ g: boolean;
16
+ };
17
+ type ReplaceWithDict = (text: string, dict?: ExtendedDict) => string;
18
+ type ToTarask = (text: string, replaceWithDict: ReplaceWithDict, wordlist: Dict, softers: Dict, afterTarask: ExtendedDict) => string;
19
+ type TaraskOptionsStrict = {
20
+ abc: Alphabet;
21
+ j: OptionJ;
22
+ html: boolean | HtmlOptions;
23
+ nonHtml: boolean | NonHtmlOptions;
24
+ OVERRIDE_toTarask?: ToTarask;
25
+ };
26
+ type TaraskOptions = DeepPartial<TaraskOptionsStrict>;
27
+ type Tarask = (text: string, options?: TaraskOptions) => string;
28
+ type TaraskAsync = Promisify<Tarask>;
29
+ type Dict<T = RegExp> = [T, string][];
30
+ type ExtendedDict = [
31
+ RegExp,
32
+ string | ((...substrings: string[]) => string)
33
+ ][];
34
+ type AlphabetDependentDict = {
35
+ [key in Alphabet]?: Dict;
36
+ };
37
+
38
+ declare const ALPHABET: {
39
+ CYRILLIC: number;
40
+ LATIN: number;
41
+ ARABIC: number;
42
+ GREEK: number;
43
+ };
44
+ declare const J: {
45
+ NEVER: number;
46
+ RANDOM: number;
47
+ ALWAYS: number;
48
+ };
49
+ declare const VARIATION: {
50
+ NO: number;
51
+ FIRST: number;
52
+ ALL: number;
53
+ };
54
+ declare const taraskSync: Tarask;
55
+ declare const tarask: TaraskAsync;
56
+
57
+ declare const gobj: {
58
+ readonly г: "ґ";
59
+ readonly Г: "Ґ";
60
+ readonly ґ: "г";
61
+ readonly Ґ: "Г";
62
+ };
63
+
64
+ export { ALPHABET, AlphabetDependentDict, Dict, ExtendedDict, HtmlOptions, J, NonHtmlOptions, ReplaceWithDict, Tarask, TaraskAsync, TaraskOptions, TaraskOptionsStrict, ToTarask, VARIATION, gobj, tarask, taraskSync };
package/dist/index.js CHANGED
@@ -519,6 +519,7 @@ var rawWordlist = [
519
519
  [/беразіном /, "(беразіном|бярэзаньню) "],
520
520
  [/ бягомль/, " (бягомель|бегамля)"],
521
521
  /* В */
522
+ [/ вайбер/, " вайбэр"],
522
523
  [/вейшнор/, "вайшнор"],
523
524
  [/валанцёр/, "валянтэр"],
524
525
  [/ валон/, " валён"],
@@ -1310,6 +1311,7 @@ var rawWordlist = [
1310
1311
  [/эмансіп/, "эмансып"],
1311
1312
  [/ эпапе/, " эпапэ"],
1312
1313
  [/епарх/, "эпарх"],
1314
+ [/ эскала/, " эскаля"],
1313
1315
  [/эсперант/, "эспэрант"],
1314
1316
  [/эстафет/, "эстафэт"],
1315
1317
  [/ еў(?=р(?:а|о|ыпід)|патор|фра|фроні|харысты)/, " эў"],
@@ -2126,7 +2128,7 @@ var taraskSync = (text, options = {}) => {
2126
2128
  const isHtmlObject = isObject(html);
2127
2129
  const isNonHtmlObject = isObject(nonHtml);
2128
2130
  if (isNonHtmlObject) {
2129
- nonHtml.variations || (nonHtml.variations = 0);
2131
+ nonHtml.variations ||= 0;
2130
2132
  }
2131
2133
  const apply = html ? tagApplications.html : tagApplications.nonHtml;
2132
2134
  const noFix = [];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "taraskevizer",
3
3
  "author": "GooseOb",
4
4
  "license": "MIT",
5
- "version": "1.5.0",
5
+ "version": "1.5.2",
6
6
  "private": false,
7
7
  "homepage": "https://gooseob.github.io/taraskevizatar/",
8
8
  "main": "dist/index.js",
@@ -37,9 +37,11 @@
37
37
  "belarusian"
38
38
  ],
39
39
  "devDependencies": {
40
+ "@types/node": "^20.5.4",
40
41
  "husky": "^8.0.3",
41
42
  "prettier": "^3.0.0",
42
- "tsup": "^6.5.0",
43
- "typescript": "^4.9.4"
43
+ "simple-git": "^3.19.1",
44
+ "tsup": "^7.2.0",
45
+ "typescript": "^5.2.2"
44
46
  }
45
47
  }