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

mnemonic-id

v3.2.7

Published

Library to generate easy to remember, and sometimes entertaining, human readable ids

Downloads

266,720

Readme

Mnemonic id

Coverage Status npm type definitions

Library to generate easy to remember, and sometimes entertaining, human readable ids.

createStoryId(); // -> awesome-chipmunk-banish-evil-rat

Partly inspired by Docker name generator and major mnemonic system.

Highlights

  • Dictionary of approximate 150 nouns (animals), 200 verbs, 500 adjectives.
  • Deterministic id size, with max word length of 10 for nouns, 8 for verbs and adjectives.
  • Customizable id generation.
  • TypeScript annotated API.
  • Slim package size with no dependencies.

Install

$ npm install mnemonic-id

Usage

Import in either way that suits your environment:

import { createNameId } from 'mnemonic-id';
createNameId();
import * as mnemonicId from 'mnemonic-id';
mnemonicId.createNameId();
const mnemonicId = require('mnemonic-id');
mnemonicId.createNameId();

Then select one of the existing id formats:

/** "noun", ≈ 10^2 permutations, 10 max length */
createNounId(); // -> narwhal

/** "adj+noun", ≈ 10^5 permutations, 19 max length */
createNameId(); // -> hungry-hippo

/** "adj+adj+noun", ≈ 10^6 permutations, 28 max length */
createLongNameId(); // -> hot-splendid-duck

/** "adj+noun+id", ≈ 10^14 permutations, 26 max length */
createUniqueNameId(); // -> dull-dugong-QkCHmf

/** "verb+adj+noun", ≈ 10^6 permutations, 28 max length */
createQuestId(); // -> find-pretty-sheep

/** "adj+noun+verb+adj+noun", ≈ 10^12 permutations, 48 max length */
createStoryId(); // -> eloquent-beaver-quote-unknown-dinosaur

/** "adj+adj+noun+verb+adj+adj+noun", ≈ 10^17 permutations, 64 max length */
createLongStoryId(); // -> wicked-evil-eel-help-horrible-pretty-hamster

/** "number" of given length, length^10 - length^9 permutations */
createNumberId(10); // -> 6941634647  (= 10^10-10^9 permutations)

/** "id" of given length, = 40^length permutations */
createId(10); // -> uXOGTUiOoD  (= 40^10 ≈ 10^16 permutations)

Or customize your own:

createCustomId({
  adjectives: 2,
  subject: true,
  verb: true,
  object: true,
  numberSuffix: 4,
  idSuffix: 6,
  delimiter: '_',
  capitalize: true
}); // -> Talented_Bold_Pig_Hunt_Brawny_Supreme_Bumblebee_6343_VQ5EAZ

Most existing formats can also be customized:

createNameId({
  adjectives: 3, 
  capitalize: true
  delimiter: '',
}); // -> OrdinaryCuddlyLaughingSquid

Options

Description of options:

interface IdOpts {
  /** Number of adjectives given to object/subject */
  adjectives?: number;
  /** Creates subject in id sentence */
  subject?: boolean;
  /** Creates verb in id sentence */
  verb?: boolean;
  /** Creates object in id sentence */
  object?: boolean;
  /** Creates number of given length at end of id sentence */
  numberSuffix?: number;
  /** Creates id of given length at end of id sentence */
  idSuffix?: number;
  /** Delimiter to be used in id sentence */
  delimiter?: string;
  /** Capitalize each word in sentence */
  capitalize?: boolean;
}

Alternatives

Similar libraries that also exist:

License

Licensed under MIT.