Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.12.0
->1.0.0
Release Notes
jhlywa/chess.js (chess.js)
v1.0.0
Compare Source
v1.0.0
A big thank you to all the contributors that helped make this release possible! This is a major version update and there are many new features and breaking changes. Please read below for more info.
Typescript
chess.js has been rewritten in TypeScript. Exported types are as follows:
Chess
objectMove
objectPiece
Color
Square
PieceSymbol
Move
New Methods
attackers(square, color)
- returns a list of squares occupied by pieces ofcolor
that are attacking the givensquare
getCastlingRights(color)
- returns{ k: boolean, q: boolean }
indicating castling rights forcolor
setCastlingRights(color, rights)
isAttacked(square, color)
- returns true ifsquare
is attacked bycolor
isDrawByFiftyMoves()
moveNumber()
setHeader(key, value)
,removeHeader(key)
,getHeaders()
removeComment()
,removeComments()
Breaking Changes
Exceptions instead of
null
The following functions no longer return
null
when an error occurs. Instead, they now throw exceptions to provide the user with more detailed error information..load()
.loadPgn()
.move()
Chess()
constructorFunction Names
The functions below have been converted to camel-case:
game_over
->isGameOver
in_check
->isCheck
in_checkmate
->isCheckmate
in_draw
->isDraw
is_stalemate
->isStalemate
in_threefold_repetition
->isThreefoldRepetition
insufficient_material
->isInsufficientMaterial
load_pgn
->loadPgn
set_comment
->setComment
get_comment
->getComment
get_comments
->getComments
delete_comment
->deleteComment
delete_comments
->deleteComments
validate_fen
->validateFen
Function Arguments and Return Values
The arguments and return values for the following functions have changed:
load_pgn(pgn, { sloppy: true })
becomesloadPgn(pgn)
(strict
defaults tofalse
)move('Nb7', { sloppy: true })
becomesmoves('Nb7')
clear(true)
should now be written asclear({ preserveHeader: true })
load(fen, true)
should now be written asload(fen, { preserveHeader: true })
validateFen(fen)
now returns{ ok: boolean, error?: string }
Deprecations
flags
field in the Move object is deprecated. Use the new helper methods below to determine the move type:.isCapture()
- is the move a regular capture? NOTE: this isfalse
for an en-passant.isEnPassant()
- is the move an en-passant capture?.isBigPawn()
- is the move a 2-rank pawn move?.isPromotion()
- is the move a pawn promotion?.isKingsideCastle()
- is the move a kingside castle?.isQueensideCastle()
- is the move a queenside castle?header
function has been deprecated in favor ofsetHeader
andgetHeaders
deleteComment
anddeleteComments
functions have deprecated in favor ofremoveComment
andremoveComments
Improvements
.load
to throw an exception when loading invalid FEN (@jhlywa -ac977ed
).move
to throw an exception on illegal move (@jhlywa -8523db8
).loadPgn
to throw an exception when encountered error (@jhlywa - #TODO).load
(@jhlywa -8523db8
)isAttacked
to determine attackers of a specific square (@jhlywa -9b49454
)validateFen
(@jhlywa -a137478
)5f48a68
)8e71084
)before
andafter
FEN to Move object (@jhlywa - d42b0)getCastlingRights
,setCastlingRights
) (@neofight78 -7cb2d34
)moveNumber
accessible (@neofight78 - #399).put()
(@gavin-lb -55181a9
)skipValidation
option to.load
(@jhlywa -e2ff91c
)isDrawByFiftyMoves
(@HarshilPatel007 - #477)Bug Fixes
loadPgn()
to handle PGN without any moves (@jhlywa -d12f78f
)pgn()
export when comment precedes black to move (@jhlywa -4fd6069
)postinstall
script (@jhlywa - 495d37)"types": "dist/chess.d.ts"
entry to package.json (@jhlywa -495d37f
)put()
(@Manukyanq #426)be03fe0
)c1909fe
)v0.13.4
Compare Source
Bug Fixes
v0.13.3
Compare Source
Bug Fixes
Changes
v0.13.2
Compare Source
Bug Fixes
24d1c86
)35e3fbf
)v0.13.1
Compare Source
Bug Fixes
62914d6
).ascii()
function (@jhlywa -450c7f1
)v0.13.0
Compare Source
Enhancements
.board()
(@fitztrev - #312)v0.12.1
Compare Source
Bug Fixes
321a25e
)1814427
)Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.