Generate random, alliterated animal names.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

1# randimal 2 3A random animal name generator, forked from 4[`random-animal-name-generator`](https://github.com/adzialocha/random-animal-name-generator). 5 6```js 7import { generateRandomName } from 'randimal' 8 9// In some async context... 10const name = await generateRandomName() 11 12console.log(name) // Geological Gnu 13``` 14 15## Differences 16 17`random-animal-name-generator` hasn't been updated in awhile, so here's a list 18of adjustments: 19 20### Async by default 21 22The word lists are absolutely massive, with previously upwards of 1700 animals 23and nearing 9000 adjectives. Loading these files is less of a problem in Node, 24but in the browser, we don't want to wait on these files to load with the main 25bundle. 26 27To combat this, the animals list and adjectives lists are loaded via dynamic 28import, so you can rely on your bundler's chunking features to load the lists 29when their necessary. To support this, **`generateRandomName` is now an async 30function.** 31 32In the future, I may consider a synchronous entry, but for now, I think this is 33an improvement. 34 35### Word lists are pre-optimized 36 37Whenever `random-animal-name-generator` is included in your application, it 38sorts the animal and adjective word lists into new objects keyed by their 39starting letter. This is deterministic—the data never changes, and so we don't 40need to rearrange it every time! So, the word lists (moved into the `data` 41folder and converted to JS modules) are now sorted by first letter by default. 42 43### Other stuff 44 45- Removed (probably) all of the animal names that consist of multiple words. The 46 smushed-together animal names were confusing to read. 47- Removed some made-up animal names... Not really sure where the data came from, 48 but I performed Google searches on a number of them and came up with nothing. 49 So, I took them out. 50- Capitalized all words on both word lists, since they're names. 51 52## Untouched Stuff 53 54While the adjectives have been capitalized, there are still quite a number of... 55creative words in the list. It seems like it came from the Scribblenauts wiki, 56which is cool, but it'll take some effort to make sure there are only 57dictionary-acknowledged adjectives in this project.