taraskevizer 5.1.9 → 5.2.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.
Files changed (3) hide show
  1. package/README.md +16 -1
  2. package/dist/bin.js +19 -3
  3. package/package.json +5 -4
package/README.md CHANGED
@@ -55,6 +55,13 @@ taraskevizer.convertToHtml('энергія планеты');
55
55
  // properties can be rewritten after creating an object
56
56
  taraskevizer.abc = ALPHABET.ARABIC;
57
57
  taraskevizer.html.g = true;
58
+
59
+ const latinizerWithJi = new Taraskevizer({
60
+ general: { abc: ALPHABET.LATIN_JI },
61
+ });
62
+
63
+ latinizerWithJi.convertAlphabetOnly('яна і іншыя');
64
+ // "jana ji jinšyja"
58
65
  ```
59
66
 
60
67
  # Options
@@ -74,6 +81,7 @@ Default value: `0`
74
81
  | 0 | cyrillic |
75
82
  | 1 | latin |
76
83
  | 2 | arabic |
84
+ | 3 | latin with ji |
77
85
 
78
86
  ### j
79
87
 
@@ -88,6 +96,8 @@ Default value: `0`
88
96
  | 1 | random | `яна і ён` or `яна й ён` |
89
97
  | 2 | always | `яна й ён` |
90
98
 
99
+ Has no effect with `LATIN_JI` alphabet.
100
+
91
101
  ### doEscapeCapitalized
92
102
 
93
103
  Type: `boolean`
@@ -96,6 +106,8 @@ Default `true`
96
106
 
97
107
  If set to false, may cause unwanted changes in acronyms.
98
108
 
109
+ Is always `true` in `convertAlphabetOnly`.
110
+
99
111
  ### OVERRIDE_taraskevize
100
112
 
101
113
  Type: `(text: string) => string`
@@ -228,6 +240,7 @@ tarask "планета"
228
240
  ```bash
229
241
  # Alpabet
230
242
  --latin (-l)
243
+ --latin-ji (-lj)
231
244
  --arabic (-a)
232
245
  # When to replace і(i) by й(j) after vowels
233
246
  --jrandom (-jr)
@@ -237,10 +250,12 @@ tarask "планета"
237
250
  # Variations
238
251
  --no-variations (-nv)
239
252
  --first-variation-only (-fvo)
253
+ # Mode
254
+ --html (-html)
255
+ --alphabet-only (-abc)
240
256
  # Other
241
257
  --not-escape-caps (-nec)
242
258
  --no-color (-nc)
243
- --html (-html)
244
259
  ```
245
260
 
246
261
  # Known bugs
package/dist/bin.js CHANGED
@@ -21,7 +21,7 @@ const nonHtml = {
21
21
  ansiColors: true
22
22
  };
23
23
  const html = { g: true };
24
- let isHtml = false;
24
+ let mode = "nonHtml";
25
25
  const toHashTable = (dict) => {
26
26
  const result = {};
27
27
  for (const [options, callback] of dict)
@@ -36,6 +36,12 @@ const optionDict = toHashTable([
36
36
  general.abc = ALPHABET.LATIN;
37
37
  }
38
38
  ],
39
+ [
40
+ ["--latin-ji", "-lj"],
41
+ () => {
42
+ general.abc = ALPHABET.LATIN_JI;
43
+ }
44
+ ],
39
45
  [
40
46
  ["--arabic", "-a"],
41
47
  () => {
@@ -88,7 +94,13 @@ const optionDict = toHashTable([
88
94
  [
89
95
  ["--html", "-html"],
90
96
  () => {
91
- isHtml = true;
97
+ mode = "html";
98
+ }
99
+ ],
100
+ [
101
+ ["--alphabet-only", "-abc"],
102
+ () => {
103
+ mode = "alphabetOnly";
92
104
  }
93
105
  ]
94
106
  ]);
@@ -115,6 +127,10 @@ if (process.argv.length) {
115
127
  }
116
128
  const taraskevizer = new Taraskevizer({ general, html, nonHtml });
117
129
  process.stdout.write(
118
- (isHtml ? taraskevizer.convertToHtml(text) : taraskevizer.convert(text)) + "\n"
130
+ {
131
+ nonHtml: taraskevizer.convert,
132
+ html: taraskevizer.convertToHtml,
133
+ alphabetOnly: taraskevizer.convertAlphabetOnly
134
+ }[mode].apply(taraskevizer, [text]) + "\n"
119
135
  );
120
136
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "5.1.9",
3
+ "version": "5.2.0",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,10 +41,11 @@
41
41
  "scripts": {
42
42
  "build": "tsup --config build-config/index.ts",
43
43
  "build:bun_EXPERIMENTAL": "bun ./build-config/bun.ts",
44
- "dev": "NOCLI=true esrun --watch=src/*,test/*,bin/* --send-code-mode=temporaryFile test",
45
- "dev:bun": "NOCLI=true bun ./test/bun-watch.ts",
46
- "dev-bun": "NOCLI=true bun test --watch",
44
+ "dev": "esrun --watch=src/*,test/*,bin/* --send-code-mode=temporaryFile test",
45
+ "dev:bun": "bun ./test/bun-watch.ts",
46
+ "dev-bun": "bun test --watch",
47
47
  "test": "esrun --send-code-mode=temporaryFile test",
48
+ "test-cli": "bun run build && esrun --send-code-mode=temporaryFile test",
48
49
  "prepare": "husky install",
49
50
  "typecheck": "tsc --project src/tsconfig.json"
50
51
  },