Generate random, alliterated animal names.
0
fork

Configure Feed

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

enable proseWrap, update README

+49 -34
+1
.prettierrc.yml
··· 3 3 singleQuote: true 4 4 useTabs: true 5 5 arrowParens: avoid 6 + proseWrap: always
+48 -34
README.md
··· 1 - # random-animal-name-generator 1 + # ranimal 2 2 3 - It's a random animal name generator! 3 + A random animal name generator, forked from 4 + [`random-animal-name-generator`](https://github.com/adzialocha/random-animal-name-generator). 4 5 5 6 ```js 6 - const generateRandomAnimalName = require('animal-name-generator') 7 - const animalName = generateRandomAnimalName() 8 - console.log(animalName) 9 - ``` 7 + import { generateRandomName } from 'ranimal' 10 8 11 - With funny animal names! 9 + // In some async context... 10 + const name = await generateRandomName() 12 11 13 - ``` 14 - Geological gnu 15 - Topazine toad 16 - Overluxurious okapi 17 - Easternmost eel 18 - Unagrarian urus 19 - Zombified zebrafinch 20 - Dull dungbeetle 21 - Jumping jaeger 22 - Controversial chimneyswift 23 - Fervid flies 24 - Ethologic eidolonhelvum 25 - Matronal mite 26 - Allied achillestang 27 - Palaeobiologic pinkriverdolphin 28 - Glossophobic goldfish 29 - Qualified queenconch 30 - Exuberant eland 31 - Timely tasmaniantiger 12 + console.log(name) // Geological Gnu 32 13 ``` 33 14 34 - ## Development 15 + ## Differences 35 16 36 - Clone the repository and install all dependencies: 17 + `random-animal-name-generator` hasn't been updated in awhile, so here's a list 18 + of adjustments: 37 19 38 - ``` 39 - git clone git@github.com:adzialocha/random-animal-name-generator.git 40 - cd random-animal-name-generator 41 - npm install 42 - npm run test 43 - ``` 20 + ### Async by default 21 + 22 + The word lists are absolutely massive, with previously upwards of 1700 animals 23 + and nearing 9000 adjectives. Loading these files is less of a problem in Node, 24 + but in the browser, we don't want to wait on these files to load with the main 25 + bundle. 26 + 27 + To combat this, the animals list and adjectives lists are loaded via dynamic 28 + import, so you can rely on your bundler's chunking features to load the lists 29 + when their necessary. To support this, **`generateRandomName` is now an async 30 + function.** 31 + 32 + In the future, I may consider a synchronous entry, but for now, I think this is 33 + an improvement. 34 + 35 + ### Word lists are pre-optimized 36 + 37 + Whenever `random-animal-name-generator` is included in your application, it 38 + sorts the animal and adjective word lists into new objects keyed by their 39 + starting letter. This is deterministic—the data never changes, and so we don't 40 + need to rearrange it every time! So, the word lists (moved into the `data` 41 + folder 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 + 54 + While the adjectives have been capitalized, there are still quite a number of... 55 + creative words in the list. It seems like it came from the Scribblenauts wiki, 56 + which is cool, but it'll take some effort to make sure there are only 57 + dictionary-acknowledged adjectives in this project.