Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-human-ids

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-human-ids

Generate human-readable ids from lists of easy-to-spell words

  • 2.0.0
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

simple-human-ids-js

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

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

  • 24-silly-goose-ran-quickly
  • 15-quick-cobra-sold-randomly
  • 23-tricky-chicken-bought-downstairs
  • 90-brave-ladybug-looked-jumped-everywhere

I frequently want human readable ids I can type without checking it multiple times. I should be able to yell these ids across the room and have people be able to enter it without confusion.

Currently the id space is about 200,000,000 ids (100 * 100 * 75 * 18 * 15).

The goal is to increase the word space to at least 1 billion while preserving the philosophy that the id would be human readable and simple to spell.

For a larger address space now, consider:

  • Human Readable IDs for Node.js and Browser: https://github.com/linus/greg/
  • Human Readable IDs for Java: https://github.com/PerWiklander/IdentifierSentence
  • Human Readable IDs for Python: https://gist.github.com/4447660

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 simple-human-ids
const id = require('simple-human-id');

// generate 100 random ids
for ( let i = 0; i < 100; i++ ) {
  console.log( id.new() );
}

You are also able to configure your own lists to use

const id = require( 'simple-human-ids' );

const numbers = [ 3, 5, 9, ... ];
const adjectives = [ 'soft', 'hard', 'wet', ... ];
const nouns = [ 'goose', 'chicken', 'ship', ... ];

const lists = id.construct( numbers, adjectives, nouns );
id.configure( lists );

for( let i = 0; i < 100; i++ ){
    console.log( id.new() );
}

Acknowledgement

This project was as effort to expand on CoolAJ87's Human Readable IDs project.

Keywords

FAQs

Package last updated on 29 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc