@scrabble-solver/types 2.15.9 → 2.15.11

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 (88) hide show
  1. package/build/Bingo.d.ts +10 -0
  2. package/build/Bingo.js +16 -0
  3. package/build/Board.d.ts +5 -6
  4. package/build/Board.js +17 -16
  5. package/build/BoardJson.d.ts +2 -3
  6. package/build/Bonus.d.ts +5 -6
  7. package/build/Bonus.js +2 -1
  8. package/build/BonusJson.d.ts +1 -2
  9. package/build/BonusValue.d.ts +1 -2
  10. package/build/Cell.d.ts +4 -5
  11. package/build/Cell.js +13 -15
  12. package/build/CellJson.d.ts +2 -3
  13. package/build/CellJson.js +2 -5
  14. package/build/CharacterBonus.d.ts +5 -6
  15. package/build/CharacterBonus.js +4 -6
  16. package/build/Collision.d.ts +2 -3
  17. package/build/CollisionJson.d.ts +2 -3
  18. package/build/Config.d.ts +15 -13
  19. package/build/Config.js +19 -15
  20. package/build/ConfigJson.d.ts +9 -8
  21. package/build/Dictionary.d.ts +2 -3
  22. package/build/FinalPattern.d.ts +2 -3
  23. package/build/FinalPattern.js +4 -6
  24. package/build/Game.d.ts +3 -2
  25. package/build/Game.js +4 -3
  26. package/build/HorizontalPattern.d.ts +2 -3
  27. package/build/HorizontalPattern.js +5 -7
  28. package/build/Locale.d.ts +1 -2
  29. package/build/Locale.js +2 -3
  30. package/build/Pattern.d.ts +5 -6
  31. package/build/Pattern.js +2 -1
  32. package/build/PatternJson.d.ts +2 -3
  33. package/build/Result.d.ts +6 -6
  34. package/build/Result.js +11 -13
  35. package/build/ResultJson.d.ts +3 -4
  36. package/build/ShowCoordinates.d.ts +1 -2
  37. package/build/Tile.d.ts +3 -4
  38. package/build/Tile.js +11 -10
  39. package/build/TileConfig.d.ts +2 -3
  40. package/build/TileJson.d.ts +1 -2
  41. package/build/TileJson.js +2 -5
  42. package/build/VerticalPattern.d.ts +2 -3
  43. package/build/VerticalPattern.js +5 -7
  44. package/build/WordBonus.d.ts +3 -4
  45. package/build/WordBonus.js +4 -6
  46. package/build/WordDefinition.d.ts +3 -4
  47. package/build/WordDefinition.js +13 -12
  48. package/build/WordDefinitionJson.d.ts +1 -2
  49. package/build/index.d.ts +32 -31
  50. package/build/index.js +24 -23
  51. package/build/isError.d.ts +1 -2
  52. package/build/isError.js +4 -6
  53. package/build/isObject.d.ts +1 -2
  54. package/build/isObject.js +2 -1
  55. package/package.json +3 -3
  56. package/src/Bingo.ts +19 -0
  57. package/src/Board.ts +14 -13
  58. package/src/BoardJson.ts +2 -4
  59. package/src/Bonus.ts +5 -7
  60. package/src/BonusJson.ts +1 -3
  61. package/src/BonusValue.ts +1 -3
  62. package/src/Cell.ts +5 -7
  63. package/src/CellJson.ts +3 -5
  64. package/src/CharacterBonus.ts +5 -7
  65. package/src/Collision.ts +2 -4
  66. package/src/CollisionJson.ts +2 -4
  67. package/src/Config.ts +27 -20
  68. package/src/ConfigJson.ts +9 -9
  69. package/src/Dictionary.ts +2 -4
  70. package/src/FinalPattern.ts +2 -4
  71. package/src/Game.ts +3 -3
  72. package/src/HorizontalPattern.ts +2 -4
  73. package/src/Locale.ts +1 -3
  74. package/src/Pattern.ts +5 -7
  75. package/src/PatternJson.ts +2 -4
  76. package/src/Result.ts +6 -8
  77. package/src/ResultJson.ts +3 -5
  78. package/src/ShowCoordinates.ts +1 -3
  79. package/src/Tile.ts +4 -6
  80. package/src/TileConfig.ts +2 -4
  81. package/src/TileJson.ts +2 -4
  82. package/src/VerticalPattern.ts +2 -4
  83. package/src/WordBonus.ts +3 -5
  84. package/src/WordDefinition.ts +4 -6
  85. package/src/WordDefinitionJson.ts +1 -3
  86. package/src/index.ts +32 -31
  87. package/src/isError.ts +2 -4
  88. package/src/isObject.ts +1 -3
@@ -0,0 +1,10 @@
1
+ export type MultiplierBingo = {
2
+ multiplier: number;
3
+ };
4
+ export type ScoreBingo = {
5
+ score: number;
6
+ };
7
+ export type Bingo = MultiplierBingo | ScoreBingo;
8
+ export declare const isBingo: (value: unknown) => value is Bingo;
9
+ export declare const isScoreBingo: (value: unknown) => value is ScoreBingo;
10
+ export declare const isMultiplierBingo: (value: unknown) => value is MultiplierBingo;
package/build/Bingo.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isMultiplierBingo = exports.isScoreBingo = exports.isBingo = void 0;
4
+ const isObject_1 = require("./isObject");
5
+ const isBingo = (value) => {
6
+ return (0, exports.isScoreBingo)(value) || (0, exports.isMultiplierBingo)(value);
7
+ };
8
+ exports.isBingo = isBingo;
9
+ const isScoreBingo = (value) => {
10
+ return (0, isObject_1.isObject)(value) && 'score' in value && typeof value.score === 'number';
11
+ };
12
+ exports.isScoreBingo = isScoreBingo;
13
+ const isMultiplierBingo = (value) => {
14
+ return (0, isObject_1.isObject)(value) && 'multiplier' in value && typeof value.multiplier === 'number';
15
+ };
16
+ exports.isMultiplierBingo = isMultiplierBingo;
package/build/Board.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import BoardJson from './BoardJson';
2
- import Cell from './Cell';
3
- declare class Board {
4
- static create(size: number): Board;
5
- static fromJson(json: BoardJson): Board;
1
+ import { BoardJson } from './BoardJson';
2
+ import { Cell } from './Cell';
3
+ export declare class Board {
4
+ static create: (width: number, height: number) => Board;
5
+ static fromJson: (json: BoardJson) => Board;
6
6
  static fromStringArray(stringArray: string[]): Board;
7
7
  readonly columnsCount: number;
8
8
  readonly rows: Cell[][];
@@ -29,4 +29,3 @@ declare class Board {
29
29
  updateCell(x: number, y: number, updateCell: (cell: Cell) => Cell): void;
30
30
  updateRow(y: number, updateRow: (cells: Cell[]) => Cell[]): void;
31
31
  }
32
- export default Board;
package/build/Board.js CHANGED
@@ -1,25 +1,15 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Board = void 0;
6
4
  const constants_1 = require("@scrabble-solver/constants");
7
- const Cell_1 = __importDefault(require("./Cell"));
8
- const Tile_1 = __importDefault(require("./Tile"));
5
+ const Cell_1 = require("./Cell");
6
+ const Tile_1 = require("./Tile");
9
7
  class Board {
10
- static create(size) {
11
- return Board.fromStringArray(Array(size).fill(Array(size).fill(' ').join('')));
12
- }
13
- static fromJson(json) {
14
- return new Board({
15
- rows: json.map((row) => row.map(Cell_1.default.fromJson)),
16
- });
17
- }
18
8
  static fromStringArray(stringArray) {
19
9
  return new Board({
20
- rows: stringArray.map((row, y) => row.split('').map((character, x) => new Cell_1.default({
10
+ rows: stringArray.map((row, y) => row.split('').map((character, x) => new Cell_1.Cell({
21
11
  isEmpty: !character || character === constants_1.EMPTY_CELL,
22
- tile: character === constants_1.EMPTY_CELL ? Tile_1.default.Null : new Tile_1.default({ character }),
12
+ tile: character === constants_1.EMPTY_CELL ? Tile_1.Tile.Null : new Tile_1.Tile({ character }),
23
13
  x,
24
14
  y,
25
15
  }))),
@@ -111,4 +101,15 @@ class Board {
111
101
  this.rows[y] = updateRow(this.rows[y]);
112
102
  }
113
103
  }
114
- exports.default = Board;
104
+ exports.Board = Board;
105
+ Board.create = (width, height) => {
106
+ const rows = Array(height);
107
+ const emptyRow = Array(width).fill(' ').join('');
108
+ const emptyRows = rows.fill(emptyRow);
109
+ return Board.fromStringArray(emptyRows);
110
+ };
111
+ Board.fromJson = (json) => {
112
+ return new Board({
113
+ rows: json.map((row) => row.map(Cell_1.Cell.fromJson)),
114
+ });
115
+ };
@@ -1,4 +1,3 @@
1
- import CellJson from './CellJson';
2
- type BoardJson = CellJson[][];
1
+ import { CellJson } from './CellJson';
2
+ export type BoardJson = CellJson[][];
3
3
  export declare const isBoardJson: (value: unknown) => value is BoardJson;
4
- export default BoardJson;
package/build/Bonus.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { BONUS_CHARACTER, BONUS_WORD } from '@scrabble-solver/constants';
2
- import BonusJson from './BonusJson';
3
- import BonusValue from './BonusValue';
4
- import Cell from './Cell';
5
- import type Config from './Config';
6
- declare abstract class Bonus {
2
+ import { BonusJson } from './BonusJson';
3
+ import { BonusValue } from './BonusValue';
4
+ import { Cell } from './Cell';
5
+ import { type Config } from './Config';
6
+ export declare abstract class Bonus {
7
7
  readonly multiplier: number;
8
8
  readonly score: number | undefined;
9
9
  abstract readonly type: typeof BONUS_CHARACTER | typeof BONUS_WORD;
@@ -20,4 +20,3 @@ declare abstract class Bonus {
20
20
  toJson(): BonusJson;
21
21
  get value(): BonusValue;
22
22
  }
23
- export default Bonus;
package/build/Bonus.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Bonus = void 0;
3
4
  class Bonus {
4
5
  constructor({ multiplier, score, x, y }) {
5
6
  this.multiplier = multiplier;
@@ -29,4 +30,4 @@ class Bonus {
29
30
  };
30
31
  }
31
32
  }
32
- exports.default = Bonus;
33
+ exports.Bonus = Bonus;
@@ -1,8 +1,7 @@
1
- interface BonusJson {
1
+ export interface BonusJson {
2
2
  multiplier: number;
3
3
  score?: number;
4
4
  type: string;
5
5
  x: number;
6
6
  y: number;
7
7
  }
8
- export default BonusJson;
@@ -1,5 +1,4 @@
1
- interface BonusValue {
1
+ export interface BonusValue {
2
2
  characterMultiplier: number;
3
3
  wordMultiplier: number;
4
4
  }
5
- export default BonusValue;
package/build/Cell.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import CellJson from './CellJson';
2
- import Tile from './Tile';
3
- declare class Cell {
4
- static fromJson(json: CellJson): Cell;
1
+ import { CellJson } from './CellJson';
2
+ import { Tile } from './Tile';
3
+ export declare class Cell {
4
+ static fromJson: (json: CellJson) => Cell;
5
5
  readonly isEmpty: boolean;
6
6
  tile: Tile;
7
7
  readonly x: number;
@@ -19,4 +19,3 @@ declare class Cell {
19
19
  toJson(): CellJson;
20
20
  toString(): string;
21
21
  }
22
- export default Cell;
package/build/Cell.js CHANGED
@@ -1,19 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const Tile_1 = __importDefault(require("./Tile"));
3
+ exports.Cell = void 0;
4
+ const Tile_1 = require("./Tile");
7
5
  class Cell {
8
- static fromJson(json) {
9
- return new Cell({
10
- isEmpty: json.isEmpty,
11
- tile: Tile_1.default.fromJson(json.tile),
12
- x: json.x,
13
- y: json.y,
14
- });
15
- }
16
- constructor({ isEmpty = true, tile = Tile_1.default.Null, x, y }) {
6
+ constructor({ isEmpty = true, tile = Tile_1.Tile.Null, x, y }) {
17
7
  this.isEmpty = isEmpty;
18
8
  this.tile = tile;
19
9
  this.x = x;
@@ -31,7 +21,7 @@ class Cell {
31
21
  return this.x === other.x && this.y === other.y && this.isEmpty === other.isEmpty && this.tile.equals(other.tile);
32
22
  }
33
23
  hasTile() {
34
- return this.tile !== Tile_1.default.Null;
24
+ return this.tile !== Tile_1.Tile.Null;
35
25
  }
36
26
  isCandidate() {
37
27
  return this.isEmpty && this.hasTile();
@@ -48,4 +38,12 @@ class Cell {
48
38
  return this.tile.toString();
49
39
  }
50
40
  }
51
- exports.default = Cell;
41
+ exports.Cell = Cell;
42
+ Cell.fromJson = (json) => {
43
+ return new Cell({
44
+ isEmpty: json.isEmpty,
45
+ tile: Tile_1.Tile.fromJson(json.tile),
46
+ x: json.x,
47
+ y: json.y,
48
+ });
49
+ };
@@ -1,9 +1,8 @@
1
- import TileJson from './TileJson';
2
- interface CellJson {
1
+ import { TileJson } from './TileJson';
2
+ export interface CellJson {
3
3
  isEmpty: boolean;
4
4
  tile: TileJson | null;
5
5
  x: number;
6
6
  y: number;
7
7
  }
8
8
  export declare const isCellJson: (value: unknown) => value is CellJson;
9
- export default CellJson;
package/build/CellJson.js CHANGED
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.isCellJson = void 0;
7
- const isObject_1 = __importDefault(require("./isObject"));
4
+ const isObject_1 = require("./isObject");
8
5
  const TileJson_1 = require("./TileJson");
9
6
  const isCellJson = (value) => {
10
- return ((0, isObject_1.default)(value) &&
7
+ return ((0, isObject_1.isObject)(value) &&
11
8
  typeof value.isEmpty === 'boolean' &&
12
9
  ((0, TileJson_1.isTileJson)(value.tile) || value.tile === null) &&
13
10
  typeof value.x === 'number' &&
@@ -1,11 +1,10 @@
1
- import Bonus from './Bonus';
2
- import BonusValue from './BonusValue';
3
- import Cell from './Cell';
4
- import type Config from './Config';
5
- declare class CharacterBonus extends Bonus {
1
+ import { Bonus } from './Bonus';
2
+ import { BonusValue } from './BonusValue';
3
+ import { Cell } from './Cell';
4
+ import { type Config } from './Config';
5
+ export declare class CharacterBonus extends Bonus {
6
6
  readonly type = "BONUS_CHARACTER";
7
7
  canApply(config: Config, cell: Cell): boolean;
8
8
  matchesCellTileScore(config: Config, cell: Cell): boolean;
9
9
  get value(): BonusValue;
10
10
  }
11
- export default CharacterBonus;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CharacterBonus = void 0;
6
4
  const constants_1 = require("@scrabble-solver/constants");
7
- const Bonus_1 = __importDefault(require("./Bonus"));
8
- class CharacterBonus extends Bonus_1.default {
5
+ const Bonus_1 = require("./Bonus");
6
+ class CharacterBonus extends Bonus_1.Bonus {
9
7
  constructor() {
10
8
  super(...arguments);
11
9
  this.type = constants_1.BONUS_CHARACTER;
@@ -26,4 +24,4 @@ class CharacterBonus extends Bonus_1.default {
26
24
  };
27
25
  }
28
26
  }
29
- exports.default = CharacterBonus;
27
+ exports.CharacterBonus = CharacterBonus;
@@ -1,3 +1,2 @@
1
- import Cell from './Cell';
2
- type Collision = Cell[];
3
- export default Collision;
1
+ import { Cell } from './Cell';
2
+ export type Collision = Cell[];
@@ -1,3 +1,2 @@
1
- import CellJson from './CellJson';
2
- type CollisionJson = CellJson[];
3
- export default CollisionJson;
1
+ import { CellJson } from './CellJson';
2
+ export type CollisionJson = CellJson[];
package/build/Config.d.ts CHANGED
@@ -1,22 +1,24 @@
1
- import Bonus from './Bonus';
2
- import BonusValue from './BonusValue';
3
- import Cell from './Cell';
4
- import ConfigJson from './ConfigJson';
5
- import Game from './Game';
6
- import Locale from './Locale';
7
- import Tile from './Tile';
8
- import TileConfig from './TileConfig';
9
- declare class Config {
10
- static fromJson(json: ConfigJson): Config;
1
+ import { Bingo } from './Bingo';
2
+ import { Bonus } from './Bonus';
3
+ import { BonusValue } from './BonusValue';
4
+ import { Cell } from './Cell';
5
+ import { ConfigJson } from './ConfigJson';
6
+ import { Game } from './Game';
7
+ import { Locale } from './Locale';
8
+ import { Tile } from './Tile';
9
+ import { TileConfig } from './TileConfig';
10
+ export declare class Config {
11
+ static fromJson: (json: ConfigJson) => Config;
11
12
  readonly bonuses: Bonus[];
12
13
  readonly config: ConfigJson;
13
14
  readonly pointsMap: Record<string, number>;
14
15
  constructor(config: ConfigJson);
15
16
  get alphabet(): string[];
16
- get bingoScore(): number;
17
+ get bingo(): Bingo;
17
18
  get blankScore(): number;
18
19
  get blanksCount(): number;
19
- get boardSize(): number;
20
+ get boardHeight(): number;
21
+ get boardWidth(): number;
20
22
  get game(): Game;
21
23
  get locale(): Locale;
22
24
  get twoCharacterTiles(): string[];
@@ -28,7 +30,7 @@ declare class Config {
28
30
  hasCharacter(character: string): boolean;
29
31
  isTwoCharacterTilePrefix(character: string): boolean;
30
32
  get rackSize(): number;
33
+ get supportsRemainingTiles(): boolean;
31
34
  get tiles(): TileConfig[];
32
35
  toJson(): ConfigJson;
33
36
  }
34
- export default Config;
package/build/Config.js CHANGED
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Config = void 0;
6
4
  const constants_1 = require("@scrabble-solver/constants");
7
- const CharacterBonus_1 = __importDefault(require("./CharacterBonus"));
8
- const WordBonus_1 = __importDefault(require("./WordBonus"));
5
+ const CharacterBonus_1 = require("./CharacterBonus");
6
+ const WordBonus_1 = require("./WordBonus");
9
7
  class Config {
10
- static fromJson(json) {
11
- return new Config(json);
12
- }
13
8
  constructor(config) {
14
9
  this.bonuses = getBonuses(config);
15
10
  this.config = config;
@@ -18,8 +13,8 @@ class Config {
18
13
  get alphabet() {
19
14
  return getAlphabet(this.config);
20
15
  }
21
- get bingoScore() {
22
- return this.config.bingoScore;
16
+ get bingo() {
17
+ return this.config.bingo;
23
18
  }
24
19
  get blankScore() {
25
20
  return this.config.blankScore;
@@ -27,8 +22,11 @@ class Config {
27
22
  get blanksCount() {
28
23
  return this.config.blanksCount;
29
24
  }
30
- get boardSize() {
31
- return this.config.boardSize;
25
+ get boardHeight() {
26
+ return this.config.boardHeight;
27
+ }
28
+ get boardWidth() {
29
+ return this.config.boardWidth;
32
30
  }
33
31
  get game() {
34
32
  return this.config.game;
@@ -75,6 +73,9 @@ class Config {
75
73
  get rackSize() {
76
74
  return this.config.rackSize;
77
75
  }
76
+ get supportsRemainingTiles() {
77
+ return this.tiles.every((tile) => typeof tile.count === 'number');
78
+ }
78
79
  get tiles() {
79
80
  return this.config.tiles;
80
81
  }
@@ -82,13 +83,17 @@ class Config {
82
83
  return this.config;
83
84
  }
84
85
  }
86
+ exports.Config = Config;
87
+ Config.fromJson = (json) => {
88
+ return new Config(json);
89
+ };
85
90
  const getBonuses = (config) => {
86
91
  return config.bonuses.map((bonus) => {
87
92
  if (bonus.type === constants_1.BONUS_CHARACTER) {
88
- return new CharacterBonus_1.default(bonus);
93
+ return new CharacterBonus_1.CharacterBonus(bonus);
89
94
  }
90
95
  if (bonus.type === constants_1.BONUS_WORD) {
91
- return new WordBonus_1.default(bonus);
96
+ return new WordBonus_1.WordBonus(bonus);
92
97
  }
93
98
  throw new Error(`Unsupported Bonus type: "${bonus.type}"`);
94
99
  });
@@ -98,4 +103,3 @@ const getPointsMap = (config) => config.tiles.reduce((pointsMap, { character, sc
98
103
  ...pointsMap,
99
104
  [character]: score,
100
105
  }), {});
101
- exports.default = Config;
@@ -1,12 +1,14 @@
1
- import BonusJson from './BonusJson';
2
- import Game from './Game';
3
- import Locale from './Locale';
4
- import TileConfig from './TileConfig';
5
- interface ConfigJson {
6
- bingoScore: number;
1
+ import { Bingo } from './Bingo';
2
+ import { BonusJson } from './BonusJson';
3
+ import { Game } from './Game';
4
+ import { Locale } from './Locale';
5
+ import { TileConfig } from './TileConfig';
6
+ export interface ConfigJson {
7
+ bingo: Bingo;
7
8
  blankScore: number;
8
9
  blanksCount: number;
9
- boardSize: number;
10
+ boardHeight: number;
11
+ boardWidth: number;
10
12
  bonuses: BonusJson[];
11
13
  game: Game;
12
14
  locale: Locale;
@@ -14,4 +16,3 @@ interface ConfigJson {
14
16
  rackSize: number;
15
17
  tiles: TileConfig[];
16
18
  }
17
- export default ConfigJson;
@@ -1,7 +1,6 @@
1
- import Locale from './Locale';
2
- interface Dictionary {
1
+ import { Locale } from './Locale';
2
+ export interface Dictionary {
3
3
  description: string;
4
4
  locale: Locale;
5
5
  name: string;
6
6
  }
7
- export default Dictionary;
@@ -1,7 +1,6 @@
1
- import Pattern from './Pattern';
2
- declare class FinalPattern extends Pattern {
1
+ import { Pattern } from './Pattern';
2
+ export declare class FinalPattern extends Pattern {
3
3
  private readonly collisions;
4
4
  constructor(pattern: Pattern);
5
5
  getCollisions(): Pattern[];
6
6
  }
7
- export default FinalPattern;
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const Pattern_1 = __importDefault(require("./Pattern"));
7
- class FinalPattern extends Pattern_1.default {
3
+ exports.FinalPattern = void 0;
4
+ const Pattern_1 = require("./Pattern");
5
+ class FinalPattern extends Pattern_1.Pattern {
8
6
  constructor(pattern) {
9
7
  super(pattern.board, pattern.cells);
10
8
  this.collisions = pattern.getCollisions();
@@ -13,4 +11,4 @@ class FinalPattern extends Pattern_1.default {
13
11
  return this.collisions;
14
12
  }
15
13
  }
16
- exports.default = FinalPattern;
14
+ exports.FinalPattern = FinalPattern;
package/build/Game.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- declare enum Game {
1
+ export declare enum Game {
2
2
  Kelimelik = "kelimelik",
3
+ LetterLeague = "letter-league",
3
4
  Literaki = "literaki",
4
5
  Scrabble = "scrabble",
6
+ ScrabbleDuel = "scrabble-duel",
5
7
  SuperScrabble = "super-scrabble"
6
8
  }
7
9
  export declare const isGame: (locale: unknown) => locale is Game;
8
- export default Game;
package/build/Game.js CHANGED
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isGame = void 0;
3
+ exports.isGame = exports.Game = void 0;
4
4
  var Game;
5
5
  (function (Game) {
6
6
  Game["Kelimelik"] = "kelimelik";
7
+ Game["LetterLeague"] = "letter-league";
7
8
  Game["Literaki"] = "literaki";
8
9
  Game["Scrabble"] = "scrabble";
10
+ Game["ScrabbleDuel"] = "scrabble-duel";
9
11
  Game["SuperScrabble"] = "super-scrabble";
10
- })(Game || (Game = {}));
12
+ })(Game || (exports.Game = Game = {}));
11
13
  const games = Object.values(Game);
12
14
  const isGame = (locale) => games.includes(locale);
13
15
  exports.isGame = isGame;
14
- exports.default = Game;
@@ -1,6 +1,5 @@
1
- import Pattern from './Pattern';
2
- declare class HorizontalPattern extends Pattern {
1
+ import { Pattern } from './Pattern';
2
+ export declare class HorizontalPattern extends Pattern {
3
3
  clone(): Pattern;
4
4
  getCollisions(): Pattern[];
5
5
  }
6
- export default HorizontalPattern;
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const Pattern_1 = __importDefault(require("./Pattern"));
7
- class HorizontalPattern extends Pattern_1.default {
3
+ exports.HorizontalPattern = void 0;
4
+ const Pattern_1 = require("./Pattern");
5
+ class HorizontalPattern extends Pattern_1.Pattern {
8
6
  clone() {
9
7
  return new HorizontalPattern(this.board, this.cells.map((cell) => cell.clone()));
10
8
  }
@@ -26,11 +24,11 @@ class HorizontalPattern extends Pattern_1.default {
26
24
  const nextCells = column.slice(cell.y + 1, y);
27
25
  const cells = [...previousCells, cell, ...nextCells];
28
26
  if (cells.length > 1) {
29
- const pattern = new Pattern_1.default(this.board, cells);
27
+ const pattern = new Pattern_1.Pattern(this.board, cells);
30
28
  collisions.push(pattern);
31
29
  }
32
30
  });
33
31
  return collisions;
34
32
  }
35
33
  }
36
- exports.default = HorizontalPattern;
34
+ exports.HorizontalPattern = HorizontalPattern;
package/build/Locale.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * @see https://en.wikipedia.org/wiki/IETF_language_tag
4
4
  * @see https://en.wikipedia.org/wiki/ISO_3166-1
5
5
  */
6
- declare enum Locale {
6
+ export declare enum Locale {
7
7
  DE_DE = "de-DE",
8
8
  EN_GB = "en-GB",
9
9
  EN_US = "en-US",
@@ -15,4 +15,3 @@ declare enum Locale {
15
15
  TR_TR = "tr-TR"
16
16
  }
17
17
  export declare const isLocale: (locale: unknown) => locale is Locale;
18
- export default Locale;
package/build/Locale.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLocale = void 0;
3
+ exports.isLocale = exports.Locale = void 0;
4
4
  /**
5
5
  * Locales are defined using IETF language tags
6
6
  * @see https://en.wikipedia.org/wiki/IETF_language_tag
@@ -17,8 +17,7 @@ var Locale;
17
17
  Locale["PL_PL"] = "pl-PL";
18
18
  Locale["RO_RO"] = "ro-RO";
19
19
  Locale["TR_TR"] = "tr-TR";
20
- })(Locale || (Locale = {}));
20
+ })(Locale || (exports.Locale = Locale = {}));
21
21
  const locales = Object.values(Locale);
22
22
  const isLocale = (locale) => locales.includes(locale);
23
23
  exports.isLocale = isLocale;
24
- exports.default = Locale;
@@ -1,8 +1,8 @@
1
- import Board from './Board';
2
- import Cell from './Cell';
3
- import Config from './Config';
4
- import PatternJson from './PatternJson';
5
- declare class Pattern {
1
+ import { Board } from './Board';
2
+ import { Cell } from './Cell';
3
+ import { Config } from './Config';
4
+ import { PatternJson } from './PatternJson';
5
+ export declare class Pattern {
6
6
  readonly board: Board;
7
7
  readonly cells: Cell[];
8
8
  constructor(board: Board, cells: Cell[]);
@@ -18,4 +18,3 @@ declare class Pattern {
18
18
  toJson(): PatternJson;
19
19
  toString(): string;
20
20
  }
21
- export default Pattern;
package/build/Pattern.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Pattern = void 0;
3
4
  class Pattern {
4
5
  constructor(board, cells) {
5
6
  this.board = board;
@@ -46,4 +47,4 @@ class Pattern {
46
47
  return this.cells.reduce((result, cell) => result + cell.toString(), '');
47
48
  }
48
49
  }
49
- exports.default = Pattern;
50
+ exports.Pattern = Pattern;
@@ -1,7 +1,6 @@
1
- import CellJson from './CellJson';
2
- interface PatternJson {
1
+ import { CellJson } from './CellJson';
2
+ export interface PatternJson {
3
3
  cells: CellJson[];
4
4
  collisions: PatternJson[];
5
5
  word: string;
6
6
  }
7
- export default PatternJson;