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

miaoda-game-blackjack-rules

v0.3.0

Published

Verified six-deck S17/H17 North American Blackjack round rules with insurance, split, double, late surrender, payouts, and safe views.

Readme

miaoda-game-blackjack-rules

Ready-to-use immutable rules for two documented North American Blackjack profiles. Both use six fresh decks, dealer hole card/peek, insurance, split/double, late surrender, and 3:2 naturals. The backward-compatible default pagat-common-6d-s17-das-ls stands on soft 17; the explicit pagat-common-6d-h17-das-ls profile hits soft 17. Other table rules and persistent shoes remain outside this package.

pnpm add miaoda-game-blackjack-rules
let state = createBlackjackRound({players: [{id: 'human', bankrollUnits: 100, betUnits: 10}], seed: 2026});
const view = createBlackjackPlayerView(state, 'human');
const result = applyBlackjackAction(state, {type: 'stand', playerId: 'human', handId: view.activeHandId!});
if (result.ok) state = result.state;

Select H17 explicitly when creating a round:

import {BLACKJACK_H17_RULESET_ID, createBlackjackRound} from 'miaoda-game-blackjack-rules';

const state = createBlackjackRound({
  players: [{id: 'human', bankrollUnits: 100, betUnits: 10}],
  rulesetId: BLACKJACK_H17_RULESET_ID,
  seed: 2026,
});

BLACKJACK_RULESET and BLACKJACK_RULESET_ID remain aliases for the default S17 profile. BLACKJACK_H17_RULESET describes H17, and BLACKJACK_RULESETS is the closed serializable profile registry. The selected ID is stored in authoritative state and copied into player views, so restore and UI code never depend on a function closure to identify table rules.

Render controls directly from legalActions; do not recalculate totals, split eligibility, funds, dealer behavior, or payouts in UI/bots. Money uses safe integer units and base bets must be positive/even so insurance, surrender, and 3:2 remain exact. At finish, use totalNetUnits and finalBankrollUnits.

Authoritative state contains the hole card and shoe and must stay on a trusted host. Player views omit them. A round snapshot is JSON-safe; validate parsed state with validateBlackjackState. Each new round creates a fresh six-deck shoe from a game-owned seed. Localize rejection codes, not diagnostic messages.

Every current BlackjackEvent is public only after it is committed: player cards are face up, dealer cards are emitted after the hole reveal, and settlement is public. Before sending events to a UI or client, call projectBlackjackEvents; its exhaustive projection fails on unknown future event types instead of accidentally forwarding them.