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

merjong

v0.0.9

Published

Generation of mahjong tile images from text written in MPSZ notation.

Downloads

43

Readme

Merjong

npm version jsDelivr

About

Merjong is a JavaScript-based image generation tool that uses MPSZ algebraic notation to create images of mahjong tiles.

Example

The following are some examples of Mahjong tile images rendered using Merjong.

<pre class="merjong">19m19p19s1234567z-q</pre>
<div class="merjong">5'55m-55"5s-555'0''p-X55Xz</div>

img/merjong-sample.png

Merjong MPSZ Notation

  • Each tile is represented by a two-character combination of a prefix [0-9QX] and a suit [mpszqx]. However, q and x can also be written as a single character.
  • The prefix 0 represents a red dora (赤ドラ), which is a red-colored variant of the number 5 tile. For example, 0m is the red five of characters (manzu), 0p is the red five of circles (pinzu), and 0s is the red five of bamboo (souzu).
  • The suit z corresponds to honor tiles: 1z = East, 2z = South, 3z = West, 4z = North, 5z = White Dragon, 6z = Green Dragon, 7z = Red Dragon.
  • Back tiles (tiles placed face down) can be written in the following formats: ^(x|[0-9]x|X[mpszqx])$ (e.g., x, Xx, Xm, Xq).
  • Question-mark tiles can be written in the following formats: ^(q|[0-9]q|Q[mpszqx])$ (e.g., q, Qq, Qm, Qx).
  • When multiple tiles share the same suit and appear consecutively, you can simplify their notation by writing the digits first, followed by a single suit character. (e.g., X11Xm, 123456789s)
  • Adding a single ' after the prefix displays the tile sideways. (e.g., 3'45m)
  • Adding '' after the prefix displays the tile on the second level of a sideways stack. (e.g., 5'0''55s)
  • Adding " after the prefix displays two stacked sideways tiles. (e.g., 33"3p)
  • A space between tiles can be written as a -. (e.g., 1'23m-45'6m)

Installation

npm

npm i merjong 

You can then import it in a browser:

<script type="module">
  import merjong from "https://cdn.jsdelivr.net/npm/merjong/+esm"
</script>

Credits

Mahjong tile images are from FluffyStuff/riichi-mahjong-tiles, released to the public domain under CC0 1.0.
Huge thanks to FluffyStuff!