chess-moments 0.14.3 → 0.14.4

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.
@@ -7,11 +7,16 @@ const { getBrushCode } = require('../helpers');
7
7
  * @returns {String} PGN string
8
8
  */
9
9
  const momentsToPgn = (moments) => {
10
+ let pgn = '';
11
+
12
+ // Return empty PGN if no moments are provided
10
13
  if (!Array.isArray(moments) || moments.length === 0) {
11
- return '';
14
+ pgn += `[SetUp "1"]\n`;
15
+ pgn += `[FEN "${initialMoment.fen}"]\n\n`;
16
+ pgn += '*';
17
+ return pgn;
12
18
  }
13
19
 
14
- let pgn = '';
15
20
  let currentDepth = 1;
16
21
  let variationStack = [];
17
22
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chess-moments",
3
- "version": "0.14.3",
3
+ "version": "0.14.4",
4
4
  "description": "PGN parser that transforms PGN files into chess \"moments\"",
5
5
  "main": "dist/index.js",
6
6
  "files": [