cm-chess 3.4.1 → 3.4.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cm-chess",
3
- "version": "3.4.1",
3
+ "version": "3.4.3",
4
4
  "description": "It's like chess.js, but in ES6 and can handle variations (tree-structured move history)",
5
5
  "main": "./src/Chess.js",
6
6
  "type": "module",
package/src/Chess.js CHANGED
@@ -338,7 +338,8 @@ export class Chess {
338
338
  factor = 1
339
339
  }
340
340
  }
341
- return (move.ply) % 2 === factor ? COLOR.white : COLOR.black
341
+ const ply = move ? move.ply : 0
342
+ return (ply) % 2 === factor ? COLOR.white : COLOR.black
342
343
  }
343
344
 
344
345
  /**
package/test/TestChess.js CHANGED
@@ -182,7 +182,6 @@ Kc4 7. Qb4+ Kd5 8. Qc5#) 5. Bc5# 1-0`)
182
182
  1-0`
183
183
  chess.loadPgn(pgn)
184
184
  chess.undo(chess.history()[5])
185
- // console.log(chess.history());
186
185
  assert.equal(chess.history().length, 5)
187
186
  assert.equal(chess.plyCount(), 5)
188
187
  assert.equal(chess.fenOfPly(0), "8/8/b2Bq3/7Q/3kp3/5pP1/8/3K4 w - - 0 1")