
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
@chess-fu/pgn-parser
Advanced tools
Chess PGN parser for 8x8 chess games for import or export standards
PGN Specification compliant parser for parsing import or export formatted PGN game data.
The library can handle some unknown characters in move text; however, it generally asserts that the formatting is loosly valid. This library does not validate legality of the moves as that is expected to be handled by another module.
Specifically this library should be compliant with the following specification sections
++
to indicate a checkmatenpm install --save @chess-fu/pgn-parser
Not much else to it.
Basic Usage:
function () {
const parser = new PgnParser();
const [game] = parser.parse(`
[Event "21st European Teams"]
[Site "Hersonissos GRE"]
[Date "2017.10.29"]
[Round "2.9"]
[White "Adams,Mi"]
[Black "Tari,A"]
[Result "1/2-1/2"]
[ECO "B11"]
1.e4 c6 2.Nf3 d5 3.Nc3 Bg4 4.h3 Bxf3 5.Qxf3 e6 6.g3 Nf6 7.Bg2 Bc5 8.O-O Nbd7
9.d3 O-O 10.Qe2 Bd4 11.Nd1 dxe4 12.dxe4 Qc7 13.c3 Bc5 14.Ne3 a5 15.Kh2 Rfe8
16.a4 Bf8 17.Nc4 Nc5 18.Bg5 h6 19.Bxf6 gxf6 20.Qg4+ Bg7 21.Qh5 Nxa4 22.Rxa4 b5
23.Rxa5 Rxa5 24.Nxa5 Qxa5 25.Qc5 Qc7 26.Ra1 Bf8 27.Qd4 Qd8 28.Qe3 Qd6 29.Qf3 Qe5
30.h4 Rd8 31.Ra6 Rc8 32.Ra7 Qb8 33.Ra6 Be7 34.Qe3 Kg7 35.Bf3 Qe5 36.Kg2 b4
37.Be2 bxc3 38.bxc3 Bc5 39.Qd3 Qd6 40.Qxd6 Bxd6 41.f4 Bc5 42.Kf3 Kf8 43.Bc4 Bg1
44.Ra2 Rb8 45.Ra6 Rc8 46.Ra1 1/2-1/2
`);
assert.isObject(game);
assert.equal(game.headers.length, 10);
assert.equal(game.history.length, 92);
assert.equal(game.history[91].result, '1/2-1/2');
}
interface HeaderEntry
name: string
The TAG tokenvalue: string
The quoted string as an unescaped string valuecomments: string[]
Comments encounteredclass MoveHistory
number: number
The move indicator if one preceded this moveraw: string
The plain-text of the move that was parsedsan: string
The normalized SAN without annotationsfrom: string
The originating file, rank or bothto: string
The target file, rank, both, or castlepiece: string
The piece that was movednag: string
The NAG string, $ followed by a numberrav: MoveHistory[]
The RAV alternative playcheck: string
The move check or mate indicatorcaptured: boolean
True if this was a capturepromotion: string
Promotion type: Q, R, N, or Bannotations: string
Annotations like !, ?, !?, etccomments: string[]
Comments encounteredresult: string
A game result, 1-0, 0-1, 1/2-1/2, or "*"unknown: string
Other non-delimiter characters following the parsed moveclass PgnGame
readonly headers: HeaderEntry[]
Returns the structured content found in the headers/tag-pairs.readonly history: MoveHistory[]
Returns the structured move text content.headersMap(): { [key: string]: string }
Returns a key-value map of headers as an object.moves(): MoveHistory[]
Returns the move history excluding any non-move entries.class PgnParser
parse(data: string): PgnGame[]
The main parse API to parse one or more games from text.Note: There are other classes and members available; however, they are not deemed part of the API. Direct use of classes/members not listed above is not recommended.
FAQs
Chess PGN parser for 8x8 chess games for import or export standards
We found that @chess-fu/pgn-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.