taraskevizer 5.1.10 → 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 +6 -2
  2. package/dist/bin.js +19 -3
  3. package/package.json +5 -4
package/README.md CHANGED
@@ -106,6 +106,8 @@ Default `true`
106
106
 
107
107
  If set to false, may cause unwanted changes in acronyms.
108
108
 
109
+ Is always `true` in `convertAlphabetOnly`.
110
+
109
111
  ### OVERRIDE_taraskevize
110
112
 
111
113
  Type: `(text: string) => string`
@@ -238,6 +240,7 @@ tarask "планета"
238
240
  ```bash
239
241
  # Alpabet
240
242
  --latin (-l)
243
+ --latin-ji (-lj)
241
244
  --arabic (-a)
242
245
  # When to replace і(i) by й(j) after vowels
243
246
  --jrandom (-jr)
@@ -247,11 +250,12 @@ tarask "планета"
247
250
  # Variations
248
251
  --no-variations (-nv)
249
252
  --first-variation-only (-fvo)
253
+ # Mode
254
+ --html (-html)
255
+ --alphabet-only (-abc)
250
256
  # Other
251
257
  --not-escape-caps (-nec)
252
258
  --no-color (-nc)
253
- --html (-html)
254
- --alphabet-only (-abc) # not working; WIP
255
259
  ```
256
260
 
257
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.10",
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
  },