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

transliterate-generator

v1.4.1

Published

`transliterate-generator` helps you build deterministic transliteration functions out of simple mapping tables. It ships with ready-made Cyrillic ↔ Latin maps and exposes a generator that can produce every transliteration variant permitted by those maps.

Readme

transliterate-generator

transliterate-generator helps you build deterministic transliteration functions out of simple mapping tables. It ships with ready-made Cyrillic ↔ Latin maps and exposes a generator that can produce every transliteration variant permitted by those maps.

Installation

npm install transliterate-generator

Usage

import transliterateGenerator, { maps } from 'transliterate-generator';

const transliterate = transliterateGenerator(maps.cyrillicToLatin, Infinity);

transliterate('привет');
// [ 'privjet', 'privyet', 'privet' ]

ℹ️ Pass a sufficiently large maxTranslits value (for unlimited output use Infinity). When the limit is omitted or reached the generator stops expanding new variants and simply appends the original characters.

When several replacements are defined for the same symbol sequence, every combination is produced:

const transliterate = transliterateGenerator(maps.cyrillicToLatin, Infinity);

transliterate('ёж');
// [ 'jozh', 'yozh' ]

Limiting the output keeps the early alternatives and leaves the rest of the word untouched.

const transliterate = transliterateGenerator(maps.latinToCyrillic, 5);

transliterate('schastie');
// [ 'зкхastie', 'скхastie', 'зчastie', 'счastie', 'шastie', 'щastie' ]

Custom maps

A transliteration map is a simple dictionary where keys are source sequences and values are arrays of replacement strings:

import transliterateGenerator from 'transliterate-generator';

const pigLatinMap = {
  hello: ['ellohay'],
  world: ['orldway'],
};

const pigLatin = transliterateGenerator(pigLatinMap, Infinity);

pigLatin('helloworld');
// [ 'ellohayorldway' ]

You can mix single characters and longer sequences in the same map. The generator automatically checks every substring up to the longest key in the map.

API

transliterateGenerator(map, maxTranslits?)

| Parameter | Type | Description | |-----------|------|-------------| | map | TranslateMap | Dictionary of source substrings to replacement arrays. | | maxTranslits | number \| null | Optional upper bound on the number of transliterations that will be expanded. Use Infinity for unrestricted output or leave null (default) to disable expansions entirely. |

Returns a function (input: string) => string[] that produces every transliteration permitted by the map while respecting the limit.

Built-in maps

Import the maps helper to access the bundled transliteration tables:

  • maps.cyrillicToLatin
  • maps.latinToCyrillic

These maps are defined in src/alphabetMaps and cover common one-to-many letter replacements.

Development

npm install      # install dependencies
npm run build    # build the library with Rollup
npm test         # run Jest against the built bundle (requires npm run build first)
npm run lint     # run ESLint on the TypeScript sources
npm run format   # verify code formatting with Prettier

License

MIT © Volodin Sergei