Skip to content

wbell/dog.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

                                                        __     Woof, bro.
     _                _          ,                    ," e`--o /
  __| | ___   __ _   (_)___     ((                   (  | __,'
 / _` |/ _ \ / _` |  | / __|     \\~----------------' \_;/
| (_| | (_) | (_| |_ | \__ \     (                      /
 \__,_|\___/ \__, (_)/ |___/     /) ._______________.  )
             |___/ |__/         (( (               (( (
                                 ``-'               ``-'

Build Status Coverage Status Dependency Status npm version

Excercise in travis ci, unit testing, code coverage, and npm. Ultimately a pointless javascript module with all of that dog flavor you love.

Setup

npm install dog.js

Usage

var Dog = require('dog.js');

var myDog = new Dog();

var bio = myDog.bio(); // get bio text

$("p").text(bio); // (example jQuery code)

myDog.bark("DERP!", alert); // alerts "Crap Dog says: DERP!"

API

Constructor: new Dog([opts])

Returns an instance of the dog class; aka a new doggie to play with!

opts

Type: object

Required: no

opts.owner

Name of the dog's owner

Type: string

Default: "Jessica"

opts.name

Name of the dog

Type: string

Default: "Crap Dog"

opts.age

The dog's age in years

Type: number

Default: 13

opts.color

Color of the dog

Type: string

Default: "doo doo brown"

opts.breed

The dog's breed

Type: string

Default: "Turd Terrier"

opts.hobbies

A list of the dog's hobbies

Type: array or string

Default: ["destroying furniture", "knocking the kids over", "dragging my butt on the white carpet"]

opts.sounds

List of sounds that the dog makes

Type: array

Default: ["woof", "bow wow", "growl"]

Methods

.bio()

Returns a short bio of the dog instance you have created with new Dog(opts)

Return Type: string

.bark([phrase] [, callback])

Returns a string of dog speech, or that string is passed to callback function if one is provided

Return Type: string

phrase

Something you want your dog to say

Type: string

Default: "woof" or "bow wow" or "growl"

Required: no

callback

A function to process your doggie words

Type: function: fn(words)

To do:

  • Add bark method
  • Add method of getting dog photo using an api
  • Make defaults less gross