npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

chess-history

v1.3.3

Published

Chess History is a library that creates chess moves history with variations

Readme

Chess History

Chess History is a library that creates chess moves history with variations

you can use it to create chess moves and store theme in a tree.

each tree node contains move name and actual move that generated with Chess.js library

Installation

To install the stable version:

# NPM

npm install chess-history

Usage

import ChessHistory from "chess-history";
//initialize Chess History
var history = new ChessHistory();

//Add move to main line
const d3 = history.addMove("e4").addMove("e5").addMove("d3");

//Continue Main Line
d3.addMove("d5").addMove("Nf3");

// Add Variation
d3.addMove("Nf6").addMove("f4").addMove("g6").addMove("Nc3");

//show pgn
console.log(history.pgn());
# result:
1. e4 e5 2. d3 d5 (2... Nf6 3. f4 g6 4. Nc3) 3. Nf3 *

Get move info

each node is an object with name and move so you can get the move like this:

import ChessHistory from "chess-history";
//initialize Chess History
let history = new ChessHistory();

//Add move
const m1 = history.addMove("e4");

//Get Move info base on chess.js moves
console.log(m1.info);
# result:
   {color: 'w', from: 'e2', to: 'e4', flags: 'b', piece: 'p', san: 'e4', Fen: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1'}

Find move by it's unique Id

each node has unique Id that you can use findMoveById method to get that move

//initialize Chess History
let history = new ChessHistory();

// add some move
const e6 = history.addMove("e4").addMove("e6");
e6.addMove("d3");

// find move by it's id
let foundNode = history.findMoveById(e6.id);
console.log(foundNode.notation);
# result:
    e6

Run tests

  • clone repository
  • npm install
  • npm run test

Examples

you can see the test files in the Test folder for more example

contribution

feel free to fork and send PR :)

Changelog

[1.3.3] - 2021-08-22

Added

  • Fen added to move info

Fixed

  • Pgn, fixed for white moves