Giter Club home page Giter Club logo

animal-namer's Introduction

Animal-Namer

Animal names for everybody!

npm install animal-namer

What?

This module generates alliterative phrases in the following format: {adjective} {animalName}

Examples:

  Overfull Okapi
  Decrepit Donkey
  Minuscule Mongoose

Why?

I wanted a way to generate simple, fun, ephemeral usernames.

How? (Usage)

Setup

var AnimalNamer = require('animal-namer');
namer = new AnimalNamer();

// You can use your own file instead
// Just put an array of strings into the file
customNamer = new AnimalNamer('path/to/my/animals.json');

Get a name

All public methods return Promises (see the Bluebird docs for more info).

namer.name().then(console.log); // => "Exemplary Elephant"

Other Stuff

You can also use the adj or animal methods to get just an animal or adjective. Either of these methods optionally take a single-letter argument, which the returned value will start with.

namer.adj('s').then(console.log); // => "Salacious"
namer.animal().then(console.log); // => "Aardvark"
namer.adjective('s').then(console.log); // alias for `adj`

Note that the list of animals is not immediately loaded.

When you call one of animal, name, or adj for the first time, AnimalNamer will read the animal list from the configured file. The result will be stored, so subsequent calls will not trigger a file-system read.

However, you can explicitly load them in advance:

// Use the packaged animal file
namer.load();

// Or use your own file
namer.load('path/to/my/animals.json');

// You can also load synchronously
namer.loadSync();

// And yes, you can still use your own file
namer.loadSync('path/to/my/animals.json');

API

Thanks to the Nicole Whitehead, animal-namer is now available as an API at animal-namer-api. The API is available to hit at Whimsical Wordimal.

Contributors

Duncan Smith (notduncansmith)

Nicole Whitehead (ncwhitehead)

Contributing

I'm happy to review any pull requests!

I just ask that you follow a few guidelines before submitting:

  • All tests must pass
  • Add tests for any new features
  • Remember to compile to Javascript

License and stuff

MIT License

Copyright 2014 Duncan Smith

animal-namer's People

Contributors

bryant1410 avatar nwjohn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.