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

@readable-code/korean

v0.1.4

Published

Korean-like Hangul word generator for readable share codes.

Downloads

638

Readme

@readable-code/korean

Korean-like Hangul word generator for readable-code share codes.

Generates pronounceable, natural-reading Hangul pseudo-words — not dictionary words, not secret tokens. Built on es-hangul.

Install

npm install @readable-code/korean

Usage

import { hangul } from "@readable-code/korean";

hangul(3).dash().digits(4).build();
// "가노미-4821"

hangul(3).dash().hangul(4).dash().digits(4).build();
// "가노미-라보수혼-7520"

build() is the finalizer. It joins the chained fragments and returns the code string.

How words are generated

Each syllable is composed from constrained jamo lists:

initial + medial + optional final

The lists deliberately avoid the full Hangul space. Random complete Hangul reads as noise (쟁헹웅항), so jamo are constrained and weighted by how they read:

  • Initial consonant (choseong) — common consonants weighted up; ㅊㅋㅌㅍ kept rare.
  • Medial vowel (jungseong) — clear open vowels weighted up.
  • Final consonant (jongseong) — mostly open syllables; only soft finals ㄴ ㄹ ㅁ ㅇ, never two finals in a row.

A final consonant (batchim) is never placed two syllables in a row, and the onset after one is constrained to avoid consonant assimilation across the boundary (for example 신라실라), so the written form matches how it is read.

API

hangul(length, options?)

Primary fluent API. Returns a builder with one Hangul pseudo-word already added, so you can keep chaining.

hangul(3).build();                  // "가노미"
hangul(3).dash().hangul(4).build(); // "가노미-라보수혼"
hangul(3, { finalConsonants: false }).dash().digits(4).build();

Builder methods: hangul(length), dash(), digits(length) / nums(length), add(value), build(), toString().

koWord(length, options?) => string

Lower-level helper that generates one Hangul pseudo-word and returns it as a plain string — no builder, no chaining, no separators or digits attached. Where hangul() starts a fluent chain, koWord() is the raw primitive underneath it: hangul(n) is essentially code().add(koWord(n)).

Reach for koWord() when you want the bare word to drop into your own composition — a custom template, an existing string, a non-CodeBuilder pipeline, or when you only need the word itself with no suffix.

import { koWord } from "@readable-code/korean";

koWord(3);                             // "가노미"
koWord(3, { finalConsonants: false }); // open syllables only, no final consonant
koWord(0);                             // "" — length 0 yields an empty string

The phonotactic smoothing (no two final consonants in a row, assimilation-safe onsets) is applied per word, so each koWord() call returns a self-consistent, readable string. Compose it manually via the core builder, or with plain string ops:

import { code } from "@readable-code/core";
import { koWord } from "@readable-code/korean";

// Equivalent to hangul(3).dash().digits(4)
code().add(koWord(3)).dash().digits(4).build();

// Or your own format, no builder at all:
`order-${koWord(3)}`;                  // "order-가노미"

Parameters

  • length (number, required) — number of Hangul syllables. Must be a non-negative integer; throws RangeError otherwise.

Options

  • finalConsonants?: boolean — whether final consonants (batchim) may appear. Defaults to true. Set false for open syllables only (every syllable ends in a vowel).
  • random?: RandomSource — custom random source from @readable-code/core for deterministic output (see below). Defaults to secureRandom (crypto.getRandomValues).

Deterministic output

Pass a custom RandomSource from @readable-code/core for reproducible tests:

import { type RandomSource } from "@readable-code/core";
import { hangul } from "@readable-code/korean";

const random: RandomSource = () => 0;
hangul(3, { random }).dash().digits(4).build();

Concept

Readable public share codes, not secret tokens. Keep uniqueness separate from the readable part — store codes under a database UNIQUE constraint and retry on collision.

License

MIT