animal-breed
v1.0.2
Published
A comprehensive database of animal breeds with origins and characteristics
Maintainers
Readme
Animal Breed Database
A comprehensive database of over 100 dog breeds with detailed information about origin, history, and ancestry.
Installation
npm install animal-breedBasic Usage
import dogBreeds from 'animal-breed';
// Search for a specific breed
const labrador = dogBreeds.searchBreed('Labrador');
console.log(labrador);
/*
{
id: 1,
name: 'Labrador Retriever',
alias: ['Labrador', 'Lab', 'Labrador Retriever Italiano'],
origin: { country: 'Canada', region: 'Newfoundland' },
history: 'Originally called the St. John\'s Dog...',
ancestry: ['St. John\'s Dog']
}
*/
// Get all breeds
const allBreeds = dogBreeds.getAllBreeds();
console.log(`Total breeds: ${allBreeds.length}`);
// Search by country of origin
const germanBreeds = dogBreeds.getBreedsByCountry('Germany');
console.log(germanBreeds); // German Shepherd, Boxer, Rottweiler, etc.
// Get autocomplete suggestions
const suggestions = dogBreeds.getSuggestions('lab', 3);
console.log(suggestions); // ['Labrador Retriever']
// Search by ancestor
const bulldogDescendants = dogBreeds.getBreedsByAncestor('Bulldog');
console.log(bulldogDescendants); // All breeds descended from Bulldog
// Get a random breed
const randomBreed = dogBreeds.getRandomBreed();
console.log(randomBreed.name);
// Fuzzy search (tolerant to typos)
const fuzzyResult = dogBreeds.fuzzySearch('germn sheperd');
console.log(fuzzyResult); // Finds 'German Shepherd'
// Access the full breeds array
const breeds = dogBreeds.breeds;Full API
searchBreed(query)
Search for a breed by name or alias.
- Params:
query(string) - Returns: Object | null
Example:
const beagle = dogBreeds.searchBreed('Beagle');
const gsd = dogBreeds.searchBreed('GSD'); // search by aliasgetAllBreeds()
Get all breeds in the database.
- Returns: Array of breed objects
getBreedsByCountry(country)
Filter breeds by country of origin.
- Params:
country(string) - Returns: Array of breed objects
getSuggestions(query, limit = 5)
Get autocomplete suggestions based on partial input.
- Params:
query(string) - partial searchlimit(number) - max results (default: 5)
- Returns: Array of breed names
getBreedsByAncestor(ancestor)
Find breeds that have a specific ancestor.
- Params:
ancestor(string) - Returns: Array of breed objects
getRandomBreed()
Get a random breed from the database.
- Returns: Object
fuzzySearch(query)
Fuzzy search tolerant to typos using Levenshtein algorithm.
- Params:
query(string) - Returns: Object | null
breeds
Direct access to the full breeds array.
Data Structure
Each breed object contains:
{
id: number,
name: string,
alias: string[],
origin: {
country: string,
region: string
},
history: string,
ancestry: string[]
}Practical Examples
- Smart search with fallback to fuzzy search
- Filter by region or country
- Autocomplete suggestions
- Find related breeds by ancestry
- Random breed quiz
Included Breeds
Over 100 breeds from all categories: popular, working, toy, rare.
Examples: Labrador Retriever, German Shepherd, Golden Retriever, French Bulldog, Beagle, Rottweiler, Doberman, Chihuahua, Basenji, Tibetan Mastiff, etc.
Geographic Coverage
Breeds from 30+ countries:
- 🇮🇹 Italy: Cane Corso, Neapolitan Mastiff
- 🇩🇪 Germany: German Shepherd, Rottweiler, Boxer
- 🇬🇧 UK: Bulldog, Beagle, English Setter
- 🇫🇷 France: French Bulldog, Basset Hound
- 🇯🇵 Japan: Akita Inu, Shiba Inu
- 🇨🇳 China: Pug, Shar Pei, Chow Chow
- 🇺🇸 USA: Boston Terrier, American Pit Bull Terrier
And many more...
Requirements
- Node.js >= 14.0.0 (ES Modules)
- Dependencies:
chalk,fuse.js
License
ISC License
Contributing
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Report Bugs
Found a bug? Open an issue on GitHub
Author
Andrea Giuseppe Cavallaro
- GitHub: @Andrea-Giuseppe-Cavallaro
- npm: animal-breed
Support
If you find this package useful, please:
- Star the GitHub repo
- Report bugs or suggest improvements
- Share with other developers
Roadmap
- [ ] Add physical characteristics (weight, height)
- [ ] Include temperament and personality
- [ ] Support for cat breeds
- [ ] API for breed images
- [ ] Advanced filters (size, FCI group)
Made with ❤️ for dog lovers and developers
