chess-moments 1.3.0 → 1.4.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,7 +1,7 @@
1
1
  const prettify = require('./prettify');
2
2
  const shape = require('./shape');
3
3
 
4
- module.exports = ({ depth, move, fen, comment, from, to }) => {
4
+ module.exports = ({ depth, move, fen, comment, suffix, from, to }) => {
5
5
  const moment = { depth, fen };
6
6
  if (move) {
7
7
  moment.move = move;
@@ -20,6 +20,9 @@ module.exports = ({ depth, move, fen, comment, from, to }) => {
20
20
  moment.shapes = shapes;
21
21
  }
22
22
  }
23
+ if (suffix) {
24
+ moment.suffix = suffix;
25
+ }
23
26
 
24
27
  return moment;
25
28
  };
@@ -12,8 +12,12 @@ module.exports = (moves, fen = initial, depth = 1) => {
12
12
  chess.undo();
13
13
  }
14
14
 
15
- const comment = chess.getComment();
16
- const first = moment.build({ depth, comment, fen: chess.fen() });
15
+ // First moment does not have a move
16
+ const first = moment.build({
17
+ depth,
18
+ comment: chess.getComment(),
19
+ fen: chess.fen(),
20
+ });
17
21
 
18
22
  const moments = history.map((item) => {
19
23
  chess.move(item.san);
@@ -24,6 +28,7 @@ module.exports = (moves, fen = initial, depth = 1) => {
24
28
  from: item.from,
25
29
  to: item.to,
26
30
  comment: chess.getComment(),
31
+ suffix: chess.getSuffixAnnotation(),
27
32
  fen: chess.fen(),
28
33
  });
29
34
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chess-moments",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "PGN parser that transforms PGN files into chess \"moments\"",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
- "chess.js": "^1.4.0"
27
+ "chess.js": "github:jhlywa/chess.js#master"
28
28
  },
29
29
  "devDependencies": {
30
30
  "chai": "^4.3.7",