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
|
-
|
|
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
|
|