taraskevizer 9.2.2 → 9.2.4

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 CHANGED
@@ -1,61 +1,60 @@
1
1
  #!/usr/bin/env node
2
2
  import { dicts, TaraskConfig, tarask, pipelines, htmlConfigOptions, wrappers, } from './index.js';
3
- const prefix = '\x1b[34m[taraskevizer]\x1b[0m ';
4
3
  const printWithPrefix = (msg) => {
5
- process.stdout.write(prefix + msg + '\n');
4
+ process.stdout.write("[taraskevizer]" + ' ' + msg + '\n');
6
5
  };
7
6
  process.argv.splice(0, 2);
8
7
  const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
9
8
  if (checkForOptions(['-v', '--version'])) {
10
- printWithPrefix("9.2.2");
9
+ printWithPrefix("9.2.4");
11
10
  process.exit(0);
12
11
  }
13
12
  if (checkForOptions(['-h', '--help'])) {
14
- printWithPrefix(`Usage: tarask [options] text
13
+ printWithPrefix(`Usage: tarask [options] text
15
14
  If text is not passed, interactive mode will be enabled
16
15
 
17
16
  EXAMPLES
18
17
 
19
18
  Convert and latinize a word
20
- tarask --latin 'планета'
21
- Will print "p<fix>l</fix>a<fix>ne</fix>ta"
19
+ tarask --latin 'планета'
20
+ Will print "planeta"
22
21
 
23
22
  Read from one file and write converted text to another
24
- tarask < ./cyr-text.txt > ./lat-text.txt
23
+ tarask < ./cyr-text.txt > ./lat-text.txt
25
24
 
26
25
  Enter interactive mode
27
- tarask
28
- Will print "[taraskevizer] Enter the text:" and wait until you press Enter
26
+ tarask
27
+ Will print "[taraskevizer] Enter the text:" and wait until you press Enter
29
28
 
30
29
  OPTIONS
31
30
 
32
- General:
33
- -h --help
34
- -v --version
31
+ General:
32
+ -h --help
33
+ -v --version
35
34
 
36
- Alphabet:
37
- -l --latin
38
- -lj --latin-ji
39
- -a --arabic
35
+ Alphabet:
36
+ -l --latin
37
+ -lj --latin-ji
38
+ -a --arabic
40
39
 
41
- When to replace і(i) by й(j) after vowels:
42
- -jr --jrandom
43
- -ja --jalways
40
+ When to replace і(i) by й(j) after vowels:
41
+ -jr --jrandom
42
+ -ja --jalways
44
43
 
45
- Replace ґ(g) by г(h) in cyrillic alphabet:
46
- --h
44
+ Replace ґ(g) by г(h) in cyrillic alphabet:
45
+ --h
47
46
 
48
- Variations:
49
- -nv --no-variations
50
- -fv --first-variation
47
+ Variations:
48
+ -nv --no-variations
49
+ -fv --first-variation
51
50
 
52
- Mode (only one can be used):
53
- -html --html
54
- -abc --alphabet-only
51
+ Mode (only one can be used):
52
+ -html --html
53
+ -abc --alphabet-only
55
54
 
56
- Other:
57
- -nec --not-escape-caps
58
- -nc --no-color
55
+ Other:
56
+ -nec --not-escape-caps
57
+ -nc --no-color
59
58
  `);
60
59
  process.exit(0);
61
60
  }
@@ -18,4 +18,4 @@ import type { TaraskStep } from '../steps/types';
18
18
  * );
19
19
  * };
20
20
  */
21
- export declare const mutatingStep: <T extends object = {}>(callback: (...args: Parameters<TaraskStep<T>>) => string) => TaraskStep<T>;
21
+ export declare const mutatingStep: <T extends object = object>(callback: (...args: Parameters<TaraskStep<T>>) => string) => TaraskStep<T>;
@@ -1,3 +1,3 @@
1
1
  export const replaceG = (replacer) => (text) => text.replace(/[Ґґ]/g,
2
- // @ts-ignore
2
+ // @ts-expect-error TS can't infer the type of replacer
3
3
  replacer);
@@ -1,7 +1,5 @@
1
1
  export const replaceWithDict = (text, dict = []) => {
2
2
  for (const [pattern, result] of dict)
3
- text = text.replace(pattern,
4
- //@ts-ignore
5
- result);
3
+ text = text.replace(pattern, result);
6
4
  return text;
7
5
  };
@@ -1,3 +1,3 @@
1
1
  import type { ExtendedDict } from './types';
2
2
  export declare const replaceWithDict: (text: string, dict: ExtendedDict, regex: RegExp) => string;
3
- export declare const log: (...msgs: any[]) => any;
3
+ export declare const log: (...msgs: unknown[]) => unknown;
@@ -1,9 +1,7 @@
1
1
  export const replaceWithDict = (text, dict, regex) => {
2
2
  for (const item of dict) {
3
3
  const [pattern, result] = item;
4
- text = text.replace(pattern,
5
- //@ts-ignore
6
- result);
4
+ text = text.replace(pattern, result);
7
5
  if (regex.test(text)) {
8
6
  log('replaceWithDict:', item);
9
7
  process.exit(1);
@@ -2,3 +2,8 @@ export type ExtendedDict = readonly (readonly [
2
2
  RegExp,
3
3
  string | ((...substrings: string[]) => string)
4
4
  ])[];
5
+ declare global {
6
+ interface String {
7
+ replace(...args: ExtendedDict[number]): string;
8
+ }
9
+ }
@@ -1 +1 @@
1
- export declare const applyVariations: import("./types").TaraskStep<{}>;
1
+ export declare const applyVariations: import("./types").TaraskStep<object>;
@@ -1,2 +1,2 @@
1
- export declare const convertAlphabet: import("./types").TaraskStep<{}>;
2
- export declare const convertAlphabetLowerCase: import("./types").TaraskStep<{}>;
1
+ export declare const convertAlphabet: import("./types").TaraskStep<object>;
2
+ export declare const convertAlphabetLowerCase: import("./types").TaraskStep<object>;
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * Removes spaces around punctuation marks and digits.
12
12
  */
13
- export declare const finalize: import("./types").TaraskStep<{}>;
13
+ export declare const finalize: import("./types").TaraskStep<object>;
@@ -1 +1 @@
1
- export declare const iotacizeJi: import("./types").TaraskStep<{}>;
1
+ export declare const iotacizeJi: import("./types").TaraskStep<object>;
@@ -1 +1 @@
1
- export declare const phonetize: import("./types").TaraskStep<{}>;
1
+ export declare const phonetize: import("./types").TaraskStep<object>;
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Some changes should be reverted in the {@link finalize} step.
5
5
  */
6
- export declare const prepare: import("./types").TaraskStep<{}>;
6
+ export declare const prepare: import("./types").TaraskStep<object>;
@@ -1 +1 @@
1
- export declare const taraskevize: import("./types").TaraskStep<{}>;
1
+ export declare const taraskevize: import("./types").TaraskStep<object>;
@@ -1 +1 @@
1
- export declare const toLowerCase: import("./types").TaraskStep<{}>;
1
+ export declare const toLowerCase: import("./types").TaraskStep<object>;
@@ -1,5 +1,5 @@
1
1
  import type { TaraskConfig } from '../config';
2
- export type TaraskStep<Storage extends object = {}> = (args: {
2
+ export type TaraskStep<Storage extends object = object> = (args: {
3
3
  text: string;
4
4
  storage: Storage;
5
5
  cfg: TaraskConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taraskevizer",
3
- "version": "9.2.2",
3
+ "version": "9.2.4",
4
4
  "author": "GooseOb",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,12 +10,16 @@
10
10
  "module": "dist/index.js",
11
11
  "devDependencies": {
12
12
  "@digitak/esrun": "^3.2.26",
13
- "@types/node": "^20.16.11",
14
- "bun-types": "^1.1.30",
13
+ "@eslint/js": "^9.13.0",
14
+ "@types/node": "^20.16.12",
15
+ "bun-types": "^1.1.31",
16
+ "eslint": "^9.13.0",
17
+ "globals": "^15.11.0",
15
18
  "husky": "^9.1.6",
16
19
  "prettier": "^3.3.3",
17
- "typedoc": "^0.26.9",
18
- "typescript": "^5.6.3"
20
+ "typedoc": "^0.26.10",
21
+ "typescript": "^5.6.3",
22
+ "typescript-eslint": "^8.11.0"
19
23
  },
20
24
  "bin": {
21
25
  "tarask": "dist/bin.js"
@@ -38,6 +42,7 @@
38
42
  "scripts": {
39
43
  "build": "bun ./build.ts",
40
44
  "prettier": "prettier --write .",
45
+ "lint": "eslint .",
41
46
  "dev": "esrun --watch=src/*,test/* --send-code-mode=temporaryFile test",
42
47
  "dev:bun": "bun test --watch",
43
48
  "test": "esrun --send-code-mode=temporaryFile test",