randimals
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

Generate adorable and unique animal IDs for your projects.

Usage

Start by installing the package locally into your project:

$ npm install randimals
# or
$ yarn add randimals

Examples

const randimals = require('randimals');

// Default arguments generate an animal with one adjective
console.log(randimals());
// => "Astronomical Wallaby"

// Using a number as an argument specifies the amount of adjectives
console.log(randimals(3));
// => "Wearable Ceramic Responsible Grizzlybear"

// Using a string as an argument specifies the naming convention
console.log(randimals('snake'));
// => "depressed_alligator"

// Combine and mess around with different options!
console.log(randimals({
  adjectives: 2,
  animals: 2,
  case: 'upper',
  separator: '.'
}));
// "DESIROUS.UNINSPIRED.COW.GRUB"

Command Line Tool

If you install the package globally, you can use the command line tool:

$ npm install -g randimals
# or
$ yarn global add randimals

CLI Examples

# default with no arguments
$ randimals
Bouncy Goose

# change amount of adjectives and animals
$ randimals -a 3 -n 2
Beamy Illtimed Comparable Neonbluehermitcrab Hoiho

# set the naming convention
$ randimals -f path
prolific/galapagosalbatross

# mix and match options
$ randimals -a 2 -c capital -s "_"
Gimmicky_Slippery_Raven

CLI Usage

$ randimals -h

  Usage: randimals [options]

  Options:
    -V, --version              output the version number
    -a, --adjectives <number>  set the number of adjectives to output (default: "1")
    -n, --animals <number>     set the number of animals to output (default: "1")
    -f, --format <string>      set the naming convention for each word (ex: 'pascal', 'snake', 'capital', etc.) (default: "capital")
    -c, --case <string>        set the case for each word (ex: 'lower', 'upper', 'capital')
    -s, --separator <string>   set the separator string between each adjective and noun
    -h, --help                 display help for command

About

A simple package that I made to emulate the random string generation that Twitch and GfyCat use for their sites. I wanted to use the strings as unique IDs in another project of mine so I decided to try writing a package myself. In the process, I learned a lot more about the TypeScript, Gulp, Browserify, and module ecosystem 😓

Notes

Big thank you to GfyCat for the adjective and animal lists. Logo image is taken from OpenMoji 13.0

License

Under the MIT License

Package Sidebar

Install

npm i randimals

Weekly Downloads

367

Version

2.0.3

License

MIT

Unpacked Size

646 kB

Total Files

27

Last publish

Collaborators

  • vincentnguyen