@scrabble-solver/types 2.9.2 → 2.10.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/build/Locale.d.ts CHANGED
@@ -3,6 +3,7 @@ declare enum Locale {
3
3
  EN_GB = "en-GB",
4
4
  EN_US = "en-US",
5
5
  ES_ES = "es-ES",
6
+ FA_IR = "fa-IR",
6
7
  FR_FR = "fr-FR",
7
8
  PL_PL = "pl-PL"
8
9
  }
package/build/Locale.js CHANGED
@@ -8,6 +8,7 @@ var Locale;
8
8
  Locale["EN_GB"] = "en-GB";
9
9
  Locale["EN_US"] = "en-US";
10
10
  Locale["ES_ES"] = "es-ES";
11
+ Locale["FA_IR"] = "fa-IR";
11
12
  Locale["FR_FR"] = "fr-FR";
12
13
  Locale["PL_PL"] = "pl-PL";
13
14
  })(Locale || (Locale = {}));
package/build/Result.d.ts CHANGED
@@ -13,7 +13,6 @@ declare class Result {
13
13
  readonly points: number;
14
14
  readonly pointsRatio: number;
15
15
  readonly tiles: Tile[];
16
- readonly tilesCharacters: string;
17
16
  readonly tilesCount: number;
18
17
  readonly vowelsCount: number;
19
18
  readonly word: string;
package/build/Result.js CHANGED
@@ -17,7 +17,6 @@ class Result {
17
17
  this.points = points;
18
18
  this.pointsRatio = getPointsRatio(tiles, points);
19
19
  this.tiles = tiles;
20
- this.tilesCharacters = getTilesCharacters(tiles);
21
20
  this.tilesCount = tiles.length;
22
21
  this.vowelsCount = getVowels(tiles).length;
23
22
  this.word = getWord(cells);
@@ -41,15 +40,11 @@ class Result {
41
40
  };
42
41
  }
43
42
  }
44
- const charactersComparator = (a, b) => a.localeCompare(b);
45
43
  const getBlanks = (tiles) => tiles.filter(({ isBlank }) => isBlank);
46
44
  const getConsonants = (tiles) => tiles.filter(isConsonant);
47
45
  const getVowels = (tiles) => tiles.filter(isVowel);
48
- const getNonBlankCharacters = (tiles) => getNonBlanks(tiles).map(({ character }) => character);
49
- const getNonBlanks = (tiles) => tiles.filter(({ isBlank }) => !isBlank);
50
46
  const getPointsRatio = (tiles, points) => points / tiles.length;
51
47
  const getTiles = (cells) => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
52
- const getTilesCharacters = (tiles) => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
53
48
  // eslint-disable-next-line prefer-template
54
49
  const getWord = (cells) => cells.reduce((word, cell) => word + cell.toString(), '');
55
50
  const getWords = (cells, collisions) => [cells, ...collisions].map(getWord);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/types",
3
- "version": "2.9.2",
3
+ "version": "2.10.0",
4
4
  "description": "Scrabble Solver 2 - Types",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "clean:force": "npm run clean && rimraf package-lock.json"
25
25
  },
26
26
  "dependencies": {
27
- "@scrabble-solver/constants": "^2.9.2"
27
+ "@scrabble-solver/constants": "^2.10.0"
28
28
  },
29
- "gitHead": "f50d782088cb89544f0c2c504f31fca81a6ff409"
29
+ "gitHead": "7fd0f6bf536fca88c18ce02e320da71b0c6d6f61"
30
30
  }
package/src/Locale.ts CHANGED
@@ -4,6 +4,7 @@ enum Locale {
4
4
  EN_GB = 'en-GB',
5
5
  EN_US = 'en-US',
6
6
  ES_ES = 'es-ES',
7
+ FA_IR = 'fa-IR',
7
8
  FR_FR = 'fr-FR',
8
9
  PL_PL = 'pl-PL',
9
10
  }
package/src/Result.ts CHANGED
@@ -34,8 +34,6 @@ class Result {
34
34
 
35
35
  public readonly tiles: Tile[];
36
36
 
37
- public readonly tilesCharacters: string;
38
-
39
37
  public readonly tilesCount: number;
40
38
 
41
39
  public readonly vowelsCount: number;
@@ -67,7 +65,6 @@ class Result {
67
65
  this.points = points;
68
66
  this.pointsRatio = getPointsRatio(tiles, points);
69
67
  this.tiles = tiles;
70
- this.tilesCharacters = getTilesCharacters(tiles);
71
68
  this.tilesCount = tiles.length;
72
69
  this.vowelsCount = getVowels(tiles).length;
73
70
  this.word = getWord(cells);
@@ -85,24 +82,16 @@ class Result {
85
82
  }
86
83
  }
87
84
 
88
- const charactersComparator = (a: string, b: string): number => a.localeCompare(b);
89
-
90
85
  const getBlanks = (tiles: Tile[]): Tile[] => tiles.filter(({ isBlank }) => isBlank);
91
86
 
92
87
  const getConsonants = (tiles: Tile[]): Tile[] => tiles.filter(isConsonant);
93
88
 
94
89
  const getVowels = (tiles: Tile[]): Tile[] => tiles.filter(isVowel);
95
90
 
96
- const getNonBlankCharacters = (tiles: Tile[]): string[] => getNonBlanks(tiles).map(({ character }) => character);
97
-
98
- const getNonBlanks = (tiles: Tile[]): Tile[] => tiles.filter(({ isBlank }) => !isBlank);
99
-
100
91
  const getPointsRatio = (tiles: Tile[], points: number): number => points / tiles.length;
101
92
 
102
93
  const getTiles = (cells: Cell[]): Tile[] => cells.filter(({ isEmpty }) => isEmpty).map(({ tile }) => tile);
103
94
 
104
- const getTilesCharacters = (tiles: Tile[]): string => getNonBlankCharacters(tiles).sort(charactersComparator).join('');
105
-
106
95
  // eslint-disable-next-line prefer-template
107
96
  const getWord = (cells: Cell[]): string => cells.reduce((word, cell) => word + cell.toString(), '');
108
97