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

@thzero/library_id_shortuuid

v0.19.1

Published

![GitHub package.json version](https://img.shields.io/github/package-json/v/thzero/library_id_shortuuid) ![David](https://img.shields.io/david/thzero/library_id_shortuuid) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://open

Downloads

240

Readme

GitHub package.json version David License: MIT

library_id_shortuuid

Id generation for @thzero/library_common, backed by uuid and short-uuid.

The only one of the three implementations whose short form is a real, lossless conversion — a 36-character uuid v4 becomes 22 characters and converts back exactly. Use this one when ids go in a url or a QR code but must remain uuids in the database.

Requirements

NodeJs

NodeJs version 22+

Installation

NPM

npm install @thzero/library_id_shortuuid

Peer dependencies

None. uuid and short-uuid are direct dependencies.

What it provides

index.js — default export IdUtility, a class of statics implementing the generator contract library_common delegates to.

| Member | Behaviour | |---|---| | generateId() | generateLongId() | | generateLongId() | A uuid v4 — 36 characters | | generateShortId() | That uuid shortened — 22 characters | | translateToShortId(id) | uuid → short form | | translateToId(short) | short form → uuid | | setAlphabet, setLengthLong, setLengthShort | No-ops. Present for contract compatibility; uuid length and alphabet are fixed |

translateToShortId throws on anything that is not a uuid — it is a conversion, not a passthrough. That is the opposite of library_id_nanoid and library_id_uuid, where both directions are identity and accept anything.

openSource.js — a default-exported function returning the licence manifest for this package, uuid and short-uuid, under both the client and server categories.

short-uuid v6

short-uuid v6 removed the callable default export that v4 had. This package uses the current API:

import { createTranslator } from 'short-uuid';
const uuidTranslator = createTranslator();

If you pin an older short-uuid, that import breaks. The package requires ^6.0.3.

Configuration

None. This package reads no configuration, and the three setters are no-ops because a uuid's shape is fixed.

Wiring it up

import IdGenerator from '@thzero/library_id_shortuuid';

Utility.setIdGenerator(IdGenerator);

On the server, through BootMain:

import IdGenerator from '@thzero/library_id_shortuuid';

class AppBootMain extends BootMain {
    _initIdGenerator() {
        return IdGenerator;
    }
}

_initIdGeneratorAlphabet, _initIdGeneratorLengthLong and _initIdGeneratorLengthShort have no effect with this generator.

Storing ids

Store the long form and convert at the boundary. Storing the short form means every lookup pays a conversion and any id that reaches the database by another route will not match.

Development

npm run lint       # eslint .
npm run lint:fix   # eslint . --fix
npm test           # node --test "test/*.test.js"