@scrabble-solver/solver 2.7.1 → 2.8.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.
@@ -15,9 +15,14 @@ var __read = (this && this.__read) || function (o, n) {
15
15
  }
16
16
  return ar;
17
17
  };
18
- var __spread = (this && this.__spread) || function () {
19
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
- return ar;
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
21
26
  };
22
27
  Object.defineProperty(exports, "__esModule", { value: true });
23
28
  var constants_1 = require("@scrabble-solver/constants");
@@ -90,7 +95,7 @@ var PatternsFiller = /** @class */ (function () {
90
95
  var remainingTiles = tiles.slice(0, firstBlankIndex).concat(tiles.slice(firstBlankIndex + 1));
91
96
  return this.config.alphabet.reduce(function (permutations, character) {
92
97
  var newTile = new types_1.Tile({ character: character, isBlank: true });
93
- var newTiles = __spread(remainingTiles, [newTile]);
98
+ var newTiles = __spreadArray(__spreadArray([], __read(remainingTiles), false), [newTile], false);
94
99
  return permutations.concat(_this.generateBlankTilesPermutations(newTiles));
95
100
  }, []);
96
101
  };
@@ -15,9 +15,14 @@ var __read = (this && this.__read) || function (o, n) {
15
15
  }
16
16
  return ar;
17
17
  };
18
- var __spread = (this && this.__spread) || function () {
19
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
- return ar;
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
21
26
  };
22
27
  Object.defineProperty(exports, "__esModule", { value: true });
23
28
  var types_1 = require("@scrabble-solver/types");
@@ -26,7 +31,7 @@ var PatternsGenerator = /** @class */ (function () {
26
31
  this.config = config;
27
32
  }
28
33
  PatternsGenerator.prototype.generate = function (board) {
29
- return __spread(this.generateHorizontal(board), this.generateVertical(board));
34
+ return __spreadArray(__spreadArray([], __read(this.generateHorizontal(board)), false), __read(this.generateVertical(board)), false);
30
35
  };
31
36
  PatternsGenerator.prototype.generateHorizontal = function (board) {
32
37
  return this.generatePatterns({
package/build/Solver.js CHANGED
@@ -19,7 +19,7 @@ var Solver = /** @class */ (function () {
19
19
  var patterns = this.patternsGenerator
20
20
  .generate(board)
21
21
  .reduce(function (filledPatterns, pattern) { return filledPatterns.concat(_this.patternsFiller.fill(pattern, tiles)); }, []);
22
- var uniquePatterns = uniqBy_1.default(patterns, function (pattern) { return JSON.stringify(pattern.toJson()); });
22
+ var uniquePatterns = (0, uniqBy_1.default)(patterns, function (pattern) { return JSON.stringify(pattern.toJson()); });
23
23
  var results = uniquePatterns.map(function (pattern, index) {
24
24
  return new types_1.Result({
25
25
  cells: pattern.cells,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/solver",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "description": "Scrabble Solver 2 - Solver",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -25,14 +25,14 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@kamilmielnik/trie": "^1.0.3",
28
- "@scrabble-solver/types": "^2.7.1",
29
- "lodash": "^4.17.20"
28
+ "@scrabble-solver/types": "^2.8.0",
29
+ "lodash": "^4.17.21"
30
30
  },
31
31
  "devDependencies": {
32
- "@scrabble-solver/configs": "^2.7.1",
33
- "@scrabble-solver/constants": "^2.7.1",
34
- "@scrabble-solver/dictionaries": "^2.7.1",
35
- "@types/lodash": "^4.14.168"
32
+ "@scrabble-solver/configs": "^2.8.0",
33
+ "@scrabble-solver/constants": "^2.8.0",
34
+ "@scrabble-solver/dictionaries": "^2.8.0",
35
+ "@types/lodash": "^4.14.185"
36
36
  },
37
- "gitHead": "c6b191428962656e3d5fedecd20043f596897a15"
37
+ "gitHead": "be53b4e8c12e092b9fc180775e700fc0c771f298"
38
38
  }
@@ -41,9 +41,7 @@ class PatternsGenerator {
41
41
  PatternModel: new (parameters: { board: Board; cells: Cell[] }) => P;
42
42
  }): P[] {
43
43
  return this.generateVectors({ getNthVector, numberOfVectors }).reduce<P[]>((patterns, cells) => {
44
- return patterns.concat(
45
- this.generateCellsPatterns<P>({ board, PatternModel, cells }),
46
- );
44
+ return patterns.concat(this.generateCellsPatterns<P>({ board, PatternModel, cells }));
47
45
  }, []);
48
46
  }
49
47