randimals
Version:
Generate unique animal IDs for your projects
102 lines (73 loc) • 2.64 kB
Markdown
<div style="text-align:center">
<img src="./docs/randimals-banner.png" width="1024px">
</div>
> Generate adorable and unique animal IDs for your projects.
Start by installing the package locally into your project:
```bash
$ npm install randimals
$ yarn add randimals
```
```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"
```
If you install the package globally, you can use the command line tool:
```bash
$ npm install -g randimals
$ yarn global add randimals
```
```shell
$ randimals
Bouncy Goose
$ randimals -a 3 -n 2
Beamy Illtimed Comparable Neonbluehermitcrab Hoiho
$ randimals -f path
prolific/galapagosalbatross
$ randimals -a 2 -c capital -s "_"
Gimmicky_Slippery_Raven
```
```shell
$ 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](https://openmoji.org/)
## License
Under the MIT License