
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
A JavaScript/TypeScript library implementing the chess game rules and providing tools to read/write the standard chess file formats.
Kokopu is a JavaScript/TypeScript chess library. It implements the chess game rules, and provides tools to read/write the standard chess file formats (PGN, FEN, UCI, etc.).
npm install kokopu
kokopu.zip,
unzip it, and include either file kokopu.js or file kokopu.min.js in your HTML page.Versions 3.0.0 and 4.0.0 introduce some breaking changes with regard to the previous versions. To determine whether your codebase needs to be adapted or not when upgrading Kokopu, please look at:
Kokopu is a headless library, meaning it does not provide any user interface. If you are interested in UI features (e.g. to be able to render a chessboard component within a web page), you may take a look at Kokopu-React, which is a React-based library built on top of Kokopu to provide these kind of features.
const { Position } = require('kokopu');
// Create a new position, play some moves...
const position = new Position();
position.play('e4');
position.play('e5');
position.play('Nf3');
// Display an ASCII-art representation of the position.
console.log(position.ascii({ coordinateVisible: true }));
// +---+---+---+---+---+---+---+---+
// 8 | r | n | b | q | k | b | n | r |
// +---+---+---+---+---+---+---+---+
// 7 | p | p | p | p | | p | p | p |
// +---+---+---+---+---+---+---+---+
// 6 | | | | | | | | |
// +---+---+---+---+---+---+---+---+
// 5 | | | | | p | | | |
// +---+---+---+---+---+---+---+---+
// 4 | | | | | P | | | |
// +---+---+---+---+---+---+---+---+
// 3 | | | | | | N | | |
// +---+---+---+---+---+---+---+---+
// 2 | P | P | P | P | | P | P | P |
// +---+---+---+---+---+---+---+---+
// 1 | R | N | B | Q | K | B | | R |
// +---+---+---+---+---+---+---+---+
// a b c d e f g h
// b KQkq -
// List the available moves.
const moves = position.moves();
console.log(moves.map(move => position.notation(move)));
// [ 'a6', 'a5', 'b6', 'b5', 'c6', 'c5', 'd6','d5', 'f6', 'f5', 'g6',
// 'g5', 'h6', 'h5', 'Na6', 'Nc6', 'Qe7', 'Qf6', 'Qg5', 'Qh4', 'Ke7',
// 'Be7', 'Bd6', 'Bc5', 'Bb4', 'Ba3', 'Nf6', 'Nh6', 'Ne7' ]
Or directly within a HTML page, if no package manager is used:
<script src="kokopu.js"></script>
<script>
const position = new kokopu.Position();
position.play('e4');
position.play('e5');
// etc...
</script>
More examples available in documentation.
FAQs
A JavaScript/TypeScript library implementing the chess game rules and providing tools to read/write the standard chess file formats.
The npm package kokopu receives a total of 45 weekly downloads. As such, kokopu popularity was classified as not popular.
We found that kokopu demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.