Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 998 Bytes

chess.ts.chess.getcomments.md

File metadata and controls

39 lines (24 loc) · 998 Bytes

Home > chess.ts > Chess > getComments

Chess.getComments() method

Retrieve comments for all positions, keyed by FEN string.

Signature:

getComments(key?: 'fen' | 'indices'): CommentMap;

Parameters

Parameter Type Description
key 'fen' | 'indices' (Optional) Key by 'fen' or node 'indices'

Returns:

CommentMap

Example

const chess = new Chess()

chess.loadPgn("1. e4 e5 {king's pawn opening} 2. Nf3 Nc6 3. Bc4 Bc5 {giuoco piano} *")

chess.getComments()
// -> {
//      "rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2": "king's pawn opening",
//      "r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3": "giuoco piano"
//    }