hunspell-reader 7.0.0-alpha.2 → 7.0.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 (2) hide show
  1. package/dist/aff.js +3 -6
  2. package/package.json +4 -10
package/dist/aff.js CHANGED
@@ -67,10 +67,8 @@ export class Aff {
67
67
  .map(({ id }) => id);
68
68
  const combinableSfx = this.joinRules(combinableRules);
69
69
  const r = affixRules
70
- .map((affix) => this.applyAffixToWord(affix, affWord, combinableSfx))
71
- .reduce((a, b) => a.concat(b), [])
72
- .map((affWord) => this.applyRulesToWord(affWord, remainingDepth - 1))
73
- .reduce((a, b) => a.concat(b), []);
70
+ .flatMap((affix) => this.applyAffixToWord(affix, affWord, combinableSfx))
71
+ .flatMap((affWord) => this.applyRulesToWord(affWord, remainingDepth - 1));
74
72
  return r;
75
73
  }
76
74
  applyAffixToWord(affix, affWord, combinableSfx) {
@@ -80,8 +78,7 @@ export class Aff {
80
78
  const matchingSubstitutions = [...affix.substitutionSets.values()].filter((sub) => sub.match.test(word));
81
79
  const partialAffWord = { ...affWord, flags, rules: combineRules };
82
80
  return matchingSubstitutions
83
- .map((sub) => sub.substitutions)
84
- .reduce((a, b) => a.concat(b), [])
81
+ .flatMap((sub) => sub.substitutions)
85
82
  .filter((sub) => sub.remove === '0' || sub.replace.test(word))
86
83
  .map((sub) => this.substitute(affix, partialAffWord, sub))
87
84
  .map((affWord) => logAffWord(affWord, 'applyAffixToWord'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hunspell-reader",
3
- "version": "7.0.0-alpha.2",
3
+ "version": "7.0.0",
4
4
  "description": "A library for reading Hunspell Dictionary Files",
5
5
  "bin": "bin.js",
6
6
  "type": "module",
@@ -43,15 +43,9 @@
43
43
  "url": "https://github.com/streetsidesoftware/cspell/issues"
44
44
  },
45
45
  "homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/hunspell-reader#readme",
46
- "devDependencies": {
47
- "@types/jest": "^29.5.1",
48
- "jest": "^29.5.0",
49
- "ts-jest": "^29.1.0",
50
- "typescript": "^4.9.5"
51
- },
52
46
  "dependencies": {
53
- "@cspell/cspell-pipe": "^7.0.0-alpha.2",
54
- "@cspell/cspell-types": "^7.0.0-alpha.2",
47
+ "@cspell/cspell-pipe": "^7.0.0",
48
+ "@cspell/cspell-types": "^7.0.0",
55
49
  "commander": "^10.0.1",
56
50
  "gensequence": "^5.0.2",
57
51
  "iconv-lite": "^0.6.3"
@@ -59,5 +53,5 @@
59
53
  "engines": {
60
54
  "node": ">=16"
61
55
  },
62
- "gitHead": "a1b7c5daeef5afdb14d6444318f450b9fd9c035a"
56
+ "gitHead": "52960d5ed75655978f9b633f44fd106937a63cd7"
63
57
  }