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

riichi-rs-bundlers

v2.1.0

Published

Small wrapper around [riichi-rust](https://github.com/MahjongPantheon/riichi-rust) to compile it to wasm, bundlers version.

Downloads

12

Readme

Riichi-rs-bundlers

Small wrapper around riichi-rust to compile it to wasm, bundlers version.

Usage

  • Install package: npm install riichi-rs-bundlers
  • Setup your webpack or other bundler to use wasm files
    • For webpack, add the following to webpack config:
    • experiments: { asyncWebAssembly: true }
  • Invoke function as follows:
import {calc, Tile, Yaku} from "riichi-rs-bundlers";

console.log(calc(
    {
        closed_part: [ // closed part of the hand. Taken tile from the wall should be the last here in case of tsumo.
            Tile.M1,
            Tile.M2,
            Tile.M3,
            Tile.M4,
            Tile.M5,
            Tile.M6,
            Tile.P9,
            Tile.P9
        ],
        open_part: [ // melds (open part)
            [
                true, // if the meld is open (pon, chi, daiminkan or shominkan);
                [Tile.M7, Tile.M8, Tile.M9],
            ],
            [
                false, // this one is ankan, so we pass false here
                [Tile.P5, Tile.P5, Tile.P5, Tile.P5] // Tiles in meld
            ],
        ],
        options: { // Note: all options are arbitrary with reasonable defaults. You can pass only few of them here.
            dora: [Tile.M3], // actual dora tiles (not indicators value)
            aka_count: 0, // count of akadora in hand
            first_take: false, // if this hand is completed on first take
            riichi: false, // if there was riichi declared
            ippatsu: false, // if ippatsu happened
            double_riichi: false, // if there was riichi declared on first turn.
            // Note that ankans are allowed, but checking if the ankan was declared before double riichi
            // (and voiding double riichi consequently) is responsibility of external code.

            after_kan: false, // chankan (on ron) or rinshan (on tsumo)
            tile_discarded_by_someone: -1, // Tile the hand won on. If tsumo, pass -1
            bakaze: Tile.South, // Round wind
            jikaze: Tile.East, // Seat wind
            allow_aka: true, // if akadora is allowed
            allow_kuitan: true, // if open tanyao is allowed
            with_kiriage: false, // if 4/30 and 3/60 hands are treated as mangan
            disabled_yaku: [Yaku.Renhou], // List of yaku to be disabled
            local_yaku_enabled: [Yaku.Daisharin], // List of local yaku to be enabled
            all_local_yaku_enabled: false, // pass true here to enable all supported local yaku
            allow_double_yakuman: false, // if double yakuman is allowed
            last_tile: false // haitei or houtei
        },
        calc_hairi: false // if completions and discard variants should be calculated
    }
));

/*
> -> Result {
    "is_agari": true, // The hand is a winning hand
    "yakuman": 0, // Cound of yakuman in the hand
    "han": 2, // Han count
    "fu": 40, // Fu count
    "ten": 3900, // Amount of paid score points, total
    "outgoing_ten": [
        1300, // This is amount of points paid by dealer on non-dealer tsumo, or by all on dealer tsumo
        700 // This is amount of points paid by non-dealer on non-dealer tsumo
    ],
    "yaku": { // Array<{ Yaku_id -> han count }>
        "30": 1,
        "53": 1
    }
}
 */

Note that returned yaku IDs are numeric strings, but you can parseInt them and then match over Yaku const enum to make them readable.