Socket
Socket
Sign inDemoInstall

chess.js

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chess.js - npm Package Compare versions

Comparing version 1.0.0-beta.4 to 1.0.0-beta.5

1

dist/chess.d.ts

@@ -86,2 +86,3 @@ /**

clear(keepHeaders?: boolean): void;
removeHeader(key: string): void;
load(fen: string, keepHeaders?: boolean): void;

@@ -88,0 +89,0 @@ fen(): string;

3

package.json
{
"name": "chess.js",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"license": "BSD-2-Clause",
"main": "dist/chess.js",
"types": "dist/chess.d.ts",
"type": "module",
"homepage": "https://github.com/jhlywa/chess.js",

@@ -9,0 +8,0 @@ "author": "Jeff Hlywa <jhlywa@gmail.com>",

@@ -543,2 +543,8 @@ /**

removeHeader(key: string) {
if (key in this._header) {
delete this._header[key]
}
}
load(fen: string, keepHeaders = false) {

@@ -831,3 +837,4 @@ let tokens = fen.split(/\s+/)

private _isKingAttacked(color: Color) {
return this._attacked(swapColor(color), this._kings[color])
const square = this._kings[color]
return square === -1 ? false : this._attacked(swapColor(color), square)
}

@@ -1213,3 +1220,3 @@

*/
if (!legal) {
if (!legal || this._kings[us] === -1) {
return moves

@@ -1979,6 +1986,14 @@ }

if (!to) {
return null;
}
for (let i = 0, len = moves.length; i < len; i++) {
if (from && to) {
// hand-compare move properties with the results from our permissive regex
if (
if (!from) {
// if there is no from square, it could be just 'x' missing from a capture
if (cleanMove === strippedSan(this._moveToSan(moves[i], moves)).replace('x', '')) {
return moves[i];
}
// hand-compare move properties with the results from our permissive regex
} else if (
(!piece || piece.toLowerCase() == moves[i].piece) &&

@@ -1988,19 +2003,18 @@ Ox88[from] == moves[i].from &&

(!promotion || promotion.toLowerCase() == moves[i].promotion)
) {
return moves[i]
} else if (overlyDisambiguated) {
/*
* SPECIAL CASE: we parsed a move string that may have an unneeded
* rank/file disambiguator (e.g. Nge7). The 'from' variable will
*/
const square = algebraic(moves[i].from)
if (
(!piece || piece.toLowerCase() == moves[i].piece) &&
Ox88[to] == moves[i].to &&
(from == square[0] || from == square[1]) &&
(!promotion || promotion.toLowerCase() == moves[i].promotion)
) {
return moves[i]
} else if (overlyDisambiguated) {
/*
* SPECIAL CASE: we parsed a move string that may have an unneeded
* rank/file disambiguator (e.g. Nge7). The 'from' variable will
*/
const square = algebraic(moves[i].from)
if (
(!piece || piece.toLowerCase() == moves[i].piece) &&
Ox88[to] == moves[i].to &&
(from == square[0] || from == square[1]) &&
(!promotion || promotion.toLowerCase() == moves[i].promotion)
) {
return moves[i]
}
}

@@ -2007,0 +2021,0 @@ }

@@ -5,3 +5,3 @@ {

"esModuleInterop": true,
"module": "ES2015",
"module": "commonjs",
"moduleResolution": "node",

@@ -12,5 +12,5 @@ "outDir": "./dist",

"strict": true,
"target": "ES2017"
"target": "es2017"
},
"include": ["src/**/*"]
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc