Wondering what’s next for npm?Check out our public roadmap! »

    randanimal

    1.0.4 • Public • Published

    randanimal

    Generates a random combination of adjective and animal name.

    Why?

    Because I found myself wanting a random name generator. I was inspired by adjective-adjective-animal (which is super cool) but I needed something with some shorter words, simpler options, and zero dependencies.

    All of the words generated by randanimal are 10 characters or less. You can choose how many adjectives to generate, and there is no risk of getting the same adjective twice in one name. You can use it synchronously or as a Promise.

    Usage

    Randanimal is available over npm and yarn. So just a simple $ yarn add randanimal will do it.

    It's also compatible with both Node.js and browser environments but the asynchronous version uses Promises so if you try to go that route in IE11 or below, you'll need to make sure you've got a global polyfill available.

    To use it, just import it:

    import { randanimal, randanimalSync } from 'randanimal';

    Next, generate a random name. If you don't pass in any arguments, you'll get 1 adjective and 1 animal name.

    randanimalSync();
    // 'Vengeful Zebra'
     
    randanimal().then(name => console.log(name))
    // 'Trilinear Chupacabra'

    But you can also control how many adjectvies to use by dropping that number in as an argument.

    randanimal(3);
    // 'Refreshing Unaccepted Erasable Rooster'
     
    randanimal(3).then(name => console.log(name))
    // 'Outdoor Gnawable Amphibole Copperhead'

    And that's it!

    Install

    npm i randanimal

    DownloadsWeekly Downloads

    349

    Version

    1.0.4

    License

    MIT

    Last publish

    Collaborators

    • avatar