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 🙏

© 2025 – Pkg Stats / Ryan Hefner

joldem

v1.0.4

Published

Parsing and Tokenizing Ranges for Texas Holdem

Readme


Joldem: Holdem range parser and tokenizer in Javascript


Joldem parses and tokenizes ranges in the commonly known formats as you would see in forums or twoplustwo.

Parsing

joldem.parse("22") === ["2h2s", "2h2c", "2h2d", "2s2c", "2s2d", "2c2d"]
joldem.parse("a2s") === ["ah2h", "as2s", "ac2c", "ad2d"]

joldem.parse("aq+") === [
  "ahqh", "asqs", "acqc", "adqd", "ahqs", "ahqc", "ahqd", "asqh", "asqc", "asqd", "acqh", 
  "acqs", "acqd", "adqh", "adqs", "adqc", "ahkh", "asks", "ackc", "adkd", "ahks", "ahkc", 
  "ahkd", "askh", "askc", "askd", "ackh", "acks", "ackd", "adkh", "adks", "adkc"]

By default parse will decompose a range into it's lowest parts. But sometimes we may want to keep a range in a higher form.

Ranges are represented by 3 levels of accuracy:

  • Level 1: The exact holecards in the form AcKc or 9s9h
  • Level 2: Combos in the form AKs, AKo, AK or 99
  • Level 3: Ranges of combos in the form AQo+ or 22-77

When parsing level 1 is the default. But we can override this to keep the range in a higher form.

joldem.parse("aq+", 2) === ["aqs", "aqo", "aks", "ako"]
joldem.parse("aq+", 3) === ["aq", "ak"]

Tokenizing

If we want to bring holecards back to a range we tokenize.

  joldem.tokenize(["aq", "ak"]) === "AQ+"
  joldem.tokenize(["ajs", "aq", "ak"]) === "AQ+ AJs"

Similarly as with parsing the 3 ranges come into effect. The default is to parse into the highest possible form or level 3. But we can override this

  joldem.tokenize(["ajs", "aq", "ak"], 2) === "AJs AQ AK"

Installing, Using the library.

NPM

npm install joldem
var joldem = require("joldem");

Webpage

download https://raw.githubusercontent.com/npiv/joldem/master/joldem.min.js

<script src="joldem.min.js"></script>

joldem will then register itself as joldem and can be used in the form joldem.parse, joldem.tokenize