hunspell-reader 9.0.1 → 9.1.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.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # hunspell-reader
2
2
 
3
- [![Build Status](https://travis-ci.org/streetsidesoftware/hunspell-reader.svg?branch=master)](https://travis-ci.org/streetsidesoftware/hunspell-reader)
4
-
5
3
  A library for reading Hunspell Dictionary files
6
4
 
7
5
  ## Application
@@ -61,16 +59,17 @@ hunspell-reader words ./en_US.dic -o en_US.txt
61
59
  ### Installation
62
60
 
63
61
  ```
64
- install -S hunspell-reader rxjs
62
+ npm install hunspell-reader
65
63
  ```
66
64
 
67
- Note: the reader uses rxjs 5.0.
68
-
69
65
  ### Usage
70
66
 
71
67
  Typescript / Javascript:
72
68
 
73
- ```typescript
69
+ <!--- @@inject: ./example-code/example.js --->
70
+
71
+ ```js
72
+ // ts-check
74
73
  import { HunspellReader } from 'hunspell-reader';
75
74
 
76
75
  const baseFile = 'en_US';
@@ -78,12 +77,15 @@ const dicFile = baseFile + '.dic';
78
77
  const affFile = baseFile + '.aff';
79
78
 
80
79
  // Initialize the reader with the Hunspell files
81
- const reader = new HunspellReader(affFile, dicFile);
80
+ const reader = await HunspellReader.createFromFiles(affFile, dicFile);
82
81
 
83
82
  // Get the words as an array
84
- const promiseArrayOfWords = reader.readWords().toArray().toPromise();
83
+ const words = [...reader];
84
+ console.log('%o', words);
85
85
  ```
86
86
 
87
+ <!--- @@inject-end: ./example-code/example.js --->
88
+
87
89
  ## Reference
88
90
 
89
91
  - [Hunspell Docs](https://github.com/hunspell/hunspell/blob/master/docs/hunspell.5.md)
package/dist/aff.d.ts CHANGED
@@ -188,7 +188,7 @@ interface AffSubstitution {
188
188
  type: AffType;
189
189
  remove: string;
190
190
  attach: string;
191
- attachRules?: RuleIdx[];
191
+ attachRules?: RuleIdx[] | undefined;
192
192
  replace: RegExp;
193
193
  }
194
194
  interface AffSubstitutionsForRegExp {
package/dist/affDef.d.ts CHANGED
@@ -4,17 +4,17 @@ export interface Fx {
4
4
  combinable: boolean;
5
5
  substitutionSets: Substitutions;
6
6
  substitutionsForRegExps: SubstitutionsForRegExp[];
7
- count?: string;
8
- extra?: string[];
7
+ count?: string | undefined;
8
+ extra?: string[] | undefined;
9
9
  }
10
10
  export type Substitutions = Map<string, SubstitutionsForRegExp>;
11
11
  export interface Substitution {
12
12
  type: 'P' | 'S';
13
13
  remove: string;
14
14
  attach: string;
15
- attachRules?: string;
15
+ attachRules?: string | undefined;
16
16
  replace: RegExp;
17
- extra?: string;
17
+ extra?: string | undefined;
18
18
  }
19
19
  export interface SubstitutionsForRegExp {
20
20
  match: RegExp;
@@ -30,44 +30,44 @@ export interface Conv {
30
30
  to: string;
31
31
  }
32
32
  export interface AffTransformFlags {
33
- KEEPCASE?: string;
34
- WARN?: string;
35
- NEEDAFFIX?: string;
36
- FORCEUCASE?: string;
37
- FORBIDDENWORD?: string;
38
- NOSUGGEST?: string;
39
- COMPOUNDBEGIN?: string;
40
- COMPOUNDEND?: string;
41
- COMPOUNDFLAG?: string;
42
- COMPOUNDFORBIDFLAG?: string;
43
- COMPOUNDMIDDLE?: string;
44
- COMPOUNDPERMITFLAG?: string;
45
- ONLYINCOMPOUND?: string;
33
+ KEEPCASE?: string | undefined;
34
+ WARN?: string | undefined;
35
+ NEEDAFFIX?: string | undefined;
36
+ FORCEUCASE?: string | undefined;
37
+ FORBIDDENWORD?: string | undefined;
38
+ NOSUGGEST?: string | undefined;
39
+ COMPOUNDBEGIN?: string | undefined;
40
+ COMPOUNDEND?: string | undefined;
41
+ COMPOUNDFLAG?: string | undefined;
42
+ COMPOUNDFORBIDFLAG?: string | undefined;
43
+ COMPOUNDMIDDLE?: string | undefined;
44
+ COMPOUNDPERMITFLAG?: string | undefined;
45
+ ONLYINCOMPOUND?: string | undefined;
46
46
  }
47
47
  export interface AffInfo extends AffTransformFlags {
48
48
  SET: string;
49
- TRY?: string;
50
- KEY?: string;
51
- WORDCHARS?: string;
52
- NOSPLITSUGS?: boolean;
53
- MAXCPDSUGS?: number;
54
- ONLYMAXDIFF?: boolean;
55
- MAXDIFF?: number;
56
- BREAK?: string[];
57
- FLAG?: string;
58
- MAP?: string[];
59
- ICONV?: Conv[];
60
- OCONV?: Conv[];
61
- REP?: Rep[];
62
- AF?: string[];
63
- COMPOUNDMIN?: number;
64
- COMPOUNDRULE?: string[];
65
- CHECKCOMPOUNDCASE?: boolean;
66
- CHECKCOMPOUNDDUP?: boolean;
67
- CHECKCOMPOUNDREP?: boolean;
68
- CHECKCOMPOUNDPATTERN?: string[][];
69
- PFX?: Map<string, Fx>;
70
- SFX?: Map<string, Fx>;
49
+ TRY?: string | undefined;
50
+ KEY?: string | undefined;
51
+ WORDCHARS?: string | undefined;
52
+ NOSPLITSUGS?: boolean | undefined;
53
+ MAXCPDSUGS?: number | undefined;
54
+ ONLYMAXDIFF?: boolean | undefined;
55
+ MAXDIFF?: number | undefined;
56
+ BREAK?: string[] | undefined;
57
+ FLAG?: string | undefined;
58
+ MAP?: string[] | undefined;
59
+ ICONV?: Conv[] | undefined;
60
+ OCONV?: Conv[] | undefined;
61
+ REP?: Rep[] | undefined;
62
+ AF?: string[] | undefined;
63
+ COMPOUNDMIN?: number | undefined;
64
+ COMPOUNDRULE?: string[] | undefined;
65
+ CHECKCOMPOUNDCASE?: boolean | undefined;
66
+ CHECKCOMPOUNDDUP?: boolean | undefined;
67
+ CHECKCOMPOUNDREP?: boolean | undefined;
68
+ CHECKCOMPOUNDPATTERN?: string[][] | undefined;
69
+ PFX?: Map<string, Fx> | undefined;
70
+ SFX?: Map<string, Fx> | undefined;
71
71
  }
72
72
  export type Rule = FlagRule | PfxRule | SfxRule;
73
73
  interface RuleBase {
package/dist/util.js CHANGED
@@ -40,7 +40,7 @@ export function* batch(i, size) {
40
40
  */
41
41
  export function filterOrderedList(compare) {
42
42
  let last;
43
- return function (t) {
43
+ return (t) => {
44
44
  const r = last === undefined ? last !== t : !!compare(last, t);
45
45
  last = r ? t : last;
46
46
  return r;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "9.0.1",
7
+ "version": "9.1.0",
8
8
  "description": "A library for reading Hunspell Dictionary Files",
9
9
  "bin": "bin.js",
10
10
  "type": "module",
@@ -48,9 +48,9 @@
48
48
  },
49
49
  "homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/hunspell-reader#readme",
50
50
  "dependencies": {
51
- "@cspell/cspell-pipe": "^9.0.1",
52
- "@cspell/cspell-types": "^9.0.1",
53
- "commander": "^13.1.0",
51
+ "@cspell/cspell-pipe": "^9.1.0",
52
+ "@cspell/cspell-types": "^9.1.0",
53
+ "commander": "^14.0.0",
54
54
  "gensequence": "^7.0.0",
55
55
  "html-entities": "^2.6.0",
56
56
  "iconv-lite": "^0.6.3"
@@ -58,5 +58,5 @@
58
58
  "engines": {
59
59
  "node": ">=20"
60
60
  },
61
- "gitHead": "bdfabd3686aac9827f3af0ceb4aa74947b5f9d60"
61
+ "gitHead": "a7ed42a31debbc86faa4a4ac2c686bdffe5b26b6"
62
62
  }