Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
mnemonic-id
Advanced tools
Library to generate easy to remember, and sometimes entertaining, human readable ids
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.
$ npm install mnemonic-id
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
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;
}
Similar libraries that also exist:
Licensed under MIT.
FAQs
Library to generate easy to remember, and sometimes entertaining, human readable ids
The npm package mnemonic-id receives a total of 53,505 weekly downloads. As such, mnemonic-id popularity was classified as popular.
We found that mnemonic-id demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.