Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vinhvn/randimals

Generate adorable and unique animal IDs for your projects
https://github.com/vinhvn/randimals

adjective animal generator random string

Last synced: 3 months ago
JSON representation

Generate adorable and unique animal IDs for your projects

Awesome Lists containing this project

README

        



> Generate adorable and unique animal IDs for your projects.

You can find the package on NPM at [npmjs.com/package/randimals](https://www.npmjs.com/package/randimals)

## Demo

You can find a live demo at [vinhvn.github.io/randimals](https://vinhvn.github.io/randimals).

## Usage

Start by installing the package locally into your project:

```bash
$ npm install randimals
# or
$ yarn add randimals
```

### Examples

```js
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:

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

### CLI Examples

```shell
# 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

```shell
$ randimals -h

Usage: randimals [options]

Options:
-V, --version output the version number
-a, --adjectives set the number of adjectives to output (default: "1")
-n, --animals set the number of animals to output (default: "1")
-f, --format set the naming convention for each word (ex: 'pascal', 'snake', 'capital', etc.) (default: "capital")
-c, --case set the case for each word (ex: 'lower', 'upper', 'capital')
-s, --separator 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](https://openmoji.org/)

## License

Under the MIT License