chess-moments 0.11.4 → 0.12.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.
@@ -1,8 +1,8 @@
1
1
  const prettify = require('./prettify');
2
2
  const shape = require('./shape');
3
3
 
4
- module.exports = ({ depth, move, fen, comment }) => {
5
- const moment = { depth, fen };
4
+ module.exports = ({ depth, move, fen, comment, from, to }) => {
5
+ const moment = { depth, fen, from, to };
6
6
  if (move) {
7
7
  moment.move = move;
8
8
  }
@@ -8,7 +8,7 @@ module.exports = (chess, moves, fen = initial, depth = 1) => {
8
8
  return [];
9
9
  }
10
10
 
11
- const history = chess.history();
11
+ const history = chess.history({ verbose: true });
12
12
  while (chess.undo()) {
13
13
  chess.undo();
14
14
  }
@@ -16,12 +16,14 @@ module.exports = (chess, moves, fen = initial, depth = 1) => {
16
16
  const comment = chess.get_comment();
17
17
  const first = moment.build({ depth, comment, fen: chess.fen() });
18
18
 
19
- const moments = history.map((move) => {
20
- chess.move(move);
19
+ const moments = history.map((item) => {
20
+ chess.move(item.san);
21
21
 
22
22
  return moment.build({
23
23
  depth,
24
- move,
24
+ move: item.san,
25
+ from: item.from,
26
+ to: item.to,
25
27
  comment: chess.get_comment(),
26
28
  fen: chess.fen(),
27
29
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chess-moments",
3
- "version": "0.11.4",
3
+ "version": "0.12.0",
4
4
  "description": "PGN parser that transforms PGN files into chess \"moments\"",
5
5
  "main": "dist/index.js",
6
6
  "files": [