@scrabble-solver/types 2.9.3 → 2.10.1
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 +1 -0
- package/build/Locale.js +1 -0
- package/build/Result.d.ts +0 -1
- package/build/Result.js +0 -5
- package/package.json +3 -3
- package/src/Locale.ts +1 -0
- package/src/Result.ts +0 -11
package/build/Locale.d.ts
CHANGED
package/build/Locale.js
CHANGED
package/build/Result.d.ts
CHANGED
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.
|
|
3
|
+
"version": "2.10.1",
|
|
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.
|
|
27
|
+
"@scrabble-solver/constants": "^2.10.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "506586e8bb9e71f9f784dabffae2229c587c5e5a"
|
|
30
30
|
}
|
package/src/Locale.ts
CHANGED
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
|
|