Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New category of animals, the flying animals #548

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions chance.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@
//if user does not put in a valid animal type, user will get an error
testRange(
!this.get("animals")[options.type.toLowerCase()],
"Please pick from desert, ocean, grassland, forest, zoo, pets, farm."
"Please pick from desert, ocean, grassland, forest, zoo, pets, farm, flyers."
);
//if user does put in valid animal type, will return a random animal of that type
return this.pick(this.get("animals")[options.type.toLowerCase()]);
}
//if user does not put in any animal type, will return a random animal regardless
var animalTypeArray = ["desert","forest","ocean","zoo","farm","pet","grassland"];
var animalTypeArray = ["desert","forest","ocean","zoo","farm","pet","grassland","flyers"];
return this.pick(this.get("animals")[this.pick(animalTypeArray)]);
};

Expand Down Expand Up @@ -7245,7 +7245,9 @@ options,
//list of pet animals comes from https://www.dogbreedinfo.com/pets/pet.htm
"pet" : ["Bearded Dragon","Birds","Burro","Cats","Chameleons","Chickens","Chinchillas","Chinese Water Dragon","Cows","Dogs","Donkey","Ducks","Ferrets","Fish","Geckos","Geese","Gerbils","Goats","Guinea Fowl","Guinea Pigs","Hamsters","Hedgehogs","Horses","Iguanas","Llamas","Lizards","Mice","Mule","Peafowl","Pigs and Hogs","Pigeons","Ponies","Pot Bellied Pig","Rabbits","Rats","Sheep","Skinks","Snakes","Stick Insects","Sugar Gliders","Tarantula","Turkeys","Turtles"],
//list of zoo animals comes from https://bronxzoo.com/animals
"zoo" : ["Aardvark","African Wild Dog","Aldabra Tortoise","American Alligator","American Bison","Amur Tiger","Anaconda","Andean Condor","Asian Elephant","Baby Doll Sheep","Bald Eagle","Barred Owl","Blue Iguana","Boer Goat","California Sea Lion","Caribbean Flamingo","Chinchilla","Collared Lemur","Coquerel's Sifaka","Cuban Amazon Parrot","Ebony Langur","Fennec Fox","Fossa","Gelada","Giant Anteater","Giraffe","Gorilla","Grizzly Bear","Henkel's Leaf-tailed Gecko","Indian Gharial","Indian Rhinoceros","King Cobra","King Vulture","Komodo Dragon","Linne's Two-toed Sloth","Lion","Little Penguin","Madagascar Tree Boa","Magellanic Penguin","Malayan Tapir","Malayan Tiger","Matschies Tree Kangaroo","Mini Donkey","Monarch Butterfly","Nile crocodile","North American Porcupine","Nubian Ibex","Okapi","Poison Dart Frog","Polar Bear","Pygmy Marmoset","Radiated Tortoise","Red Panda","Red Ruffed Lemur","Ring-tailed Lemur","Ring-tailed Mongoose","Rock Hyrax","Small Clawed Asian Otter","Snow Leopard","Snowy Owl","Southern White-faced Owl","Southern White Rhinocerous","Squirrel Monkey","Tufted Puffin","White Cheeked Gibbon","White-throated Bee Eater","Zebra"]
"zoo" : ["Aardvark","African Wild Dog","Aldabra Tortoise","American Alligator","American Bison","Amur Tiger","Anaconda","Andean Condor","Asian Elephant","Baby Doll Sheep","Bald Eagle","Barred Owl","Blue Iguana","Boer Goat","California Sea Lion","Caribbean Flamingo","Chinchilla","Collared Lemur","Coquerel's Sifaka","Cuban Amazon Parrot","Ebony Langur","Fennec Fox","Fossa","Gelada","Giant Anteater","Giraffe","Gorilla","Grizzly Bear","Henkel's Leaf-tailed Gecko","Indian Gharial","Indian Rhinoceros","King Cobra","King Vulture","Komodo Dragon","Linne's Two-toed Sloth","Lion","Little Penguin","Madagascar Tree Boa","Magellanic Penguin","Malayan Tapir","Malayan Tiger","Matschies Tree Kangaroo","Mini Donkey","Monarch Butterfly","Nile crocodile","North American Porcupine","Nubian Ibex","Okapi","Poison Dart Frog","Polar Bear","Pygmy Marmoset","Radiated Tortoise","Red Panda","Red Ruffed Lemur","Ring-tailed Lemur","Ring-tailed Mongoose","Rock Hyrax","Small Clawed Asian Otter","Snow Leopard","Snowy Owl","Southern White-faced Owl","Southern White Rhinocerous","Squirrel Monkey","Tufted Puffin","White Cheeked Gibbon","White-throated Bee Eater","Zebra"],
// list of flying animals comes from https://7esl.com/birds-vocabulary-english/
"flyers": ["Crested Auklet","Great Auk","Japanese Murrelet","Little Auk","Razorbill","Brewer's Blackbird","Cuban Blackbird","Eurasian Blackbird","Red-Winged Blackbird","Tawny-Shouldered Blackbird","Black-Capped Chickadee","Boreal Chickadee","Carolina Chickadee","Chestnut-Backed Chickadee","Gray-Headed Chickadee","American Crow","Cape Crow","Carrion Crow","Collared Crow","Eastern Jungle Crow","African Collard Dove","Carribean Dove","Common Ground Dove","Eurasian Collared Dove","European Turtle Dove","African Black Duck","American Black Duck","Australian Wood Duck","Black-Headed Duck","Comb Duck","African Hobby","American Kestrel","Amur Falcon","Aplomado Falcon","Australian Kestrel","Brambling","Bullfinch","Chaffinch","Common Redpoll","Common Rosefinch","North American Flycatcher","Eurasian Flycatcher","Mexican Flycatcher","Grey Partridge","Bobwhite Quail","Ringneck Pheasant","Ruffed Grouse","Sharptail Grouse","African Goose","Barnacle Goose","Canada Goose","Crested Goose","Emperor Goose","Andean gull","Common Gull","Gray Gull","Ivory Gull","Laughing Gull","Broad-Winged Hawk","Cooper's Hawk","Ferruginous Hawk","Gray Hawk","Harris's Hawk","American Bittern","Cattle Egret","Glossy Ibis","Great Blue Heron","Great Egret","Allen's Hummingbird","Anna's Hummingbird","Bee Hummingbird (This is the smallest bird!)","Black-Chinned Hummingbird","Broad-Tailed Hummingbird","Amazon Kingfisher","Azure Kingfisher","Belted Kingfisher","Collard Kingfisher","Common Kingfisher","Brown-Headed Nuthatch","Eurasian Nuthatch","Pygmy Nuthatch","Masai Ostrich","North African Ostrich","Southern Ostrich","Barn Owl","Eastern Screech Owl","Great Horned Owl","African Grey","Amazon Parrot","Macaw","Adelie Penguin","Chinstrap Penguin","Emperor Penguin","Berne Lark","Domestic Pigeon","Homing Pigeon","Australian Raven","Common Raven","Forest Rave","Albatross","Booby","Cormorant","American Golden Plover","Baird's Sandpiper"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency:
Andean gull should be Andean Gull

Also, I'm not sure if we should be providing facts in the list:
Bee Hummingbird (This is the smallest bird!) should be Bee Hummingbird 🤷

Do ostriches fly? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please keep this array alphabetized so don't put flyers after zoo please insert in the right place

},
primes: [
// 1230 first primes, i.e. all primes up to the first one greater than 10000, inclusive.
Expand Down
2 changes: 1 addition & 1 deletion test/test.animal.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ test('throws an error if the type is not part of the animals object', t => {
const fn = () => chance.animal({
type: "banana"
})
t.throws(fn, "Please pick from desert, ocean, grassland, forest, zoo, pets, farm.")
t.throws(fn, "Please pick from desert, ocean, grassland, forest, zoo, pets, farm, flyers.")
})
})