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 🙏

© 2024 – Pkg Stats / Ryan Hefner

human-readable-ids

v1.0.4

Published

Generate human-readable ids from lists of easy-to-spell nouns and adjectives

Downloads

25,540

Readme

human-readable-ids-js

Use JavaScript to generate human-readable ids from a lists of nouns and adjectives.

Generate ids in the format of adjective-noun-# such as

  • silly-goose-37
  • quick-cobra-15
  • tricky-chicken-23
  • brave-ladybug-90

My problem is that I often want ids that I can type without having to look at twice (nor telling someone else twice).

I should be able to shout one of these ids across the room to a co-worker or spouse and have them be able to enter it without any confusion.

Currently the id space is about 1,000,000 ids (100 * 100 * 100).

The goal is to have several billion possible combinations by adding more words as well as expanding the ids to have verbs and adverbs.

For a larger address space now, consider:

All of these also have the benefit of bi-directional conversion, but not all of them have words which are easy to pronounce and spell.

Usage

npm

# from npm
npm install --save human-readable-ids
# directly from git
npm install --save https://git.coolaj86.com/coolaj86/human-readable-ids.js.git
'use strict';

var hri = require('human-readable-ids').hri;
var i;

// generate 100 random ids
for (i = 0; i < 100; i += 1) {
  console.log(hri.random());
}

bower / browser

bower install --save human-readable-ids
    <script src="bower_components/knuth-shuffle/index.js"></script>
    <script src="bower_components/human-readable-ids/assets/animals.js"></script>
    <script src="bower_components/human-readable-ids/assets/adjectives.js"></script>
    <script src="bower_components/human-readable-ids/index.js"></script>
;(function (exports) {
  'use strict';

  var hri = exports.humanReadableIds || require('human-readable-ids').hri;
  var i;

  for (i = 0; i < 100; i += 1) {
    console.log(hri.random());
  }
}('undefined' !== typeof exports && exports || new Function('return this')()));

Contributing

Please add more words that fit these criteria

  • Easy-to-spell - such that even my redneck dad can manage
  • Phonetically distinct - no words like bore/boar
  • Few syllables
  • Well-known

All of the words are sorted alphabetically (sort -u) and stored in the *.txt files. The pre-publish script outputs the formatted javascript.

Bad Examples

  • wednesday, hamster, ostrich (difficult to spell)
  • grey, gray, bore, boar (two ways of spelling the same word or sound)
  • prawn (not well-known)

Resources

Add more words and strategies from

TODO

Acheive 1 trillion ids with a combination such as

number adjective noun verb adverb

42-red-foxes-run-quickly

And allow choosing various formats based on the desired number of ids.

  • adjective noun number
  • number adjective noun verb