hobby-by-category
v1.0.1
Published
A comprehensive, type-safe list of hobbies organized by categories.
Maintainers
Readme
hobby-by-category 🎨⚡🏕️
A comprehensive, type-safe list of hobbies organized by categories. Perfect for forms, recommendation systems, and hobby discovery apps.
Features
- 300+ hobbies across 10 categories
- TypeScript & JavaScript support
- Ready for dropdowns/forms
- Utility functions for easy access
- Zero dependencies
- Active maintenance
Installation
npm install hobby-by-category
# or
yarn add hobby-by-categoryBasic Usage
JavaScript (CommonJS)
const hobbies = require('hobby-by-category');
// Access all creative hobbies
console.log(hobbies.creativeAndArtistic);
// Get random outdoor activity
const randomHobby = hobbies.getRandomHobby('outdoorAndAdventure');TypeScript/ES Modules
import hobbies, { getHobbiesByCategory } from 'hobby-by-category';
// Get all photography-related hobbies
const photoHobbies = getHobbiesByCategory('creativeAndArtistic')
.filter(h => h.includes('Photography'));Available Categories
creativeAndArtistic- Painting, Drawing, Photography, etc.outdoorAndAdventure- Hiking, Camping, Rock Climbing, etc.sportsAndFitness- Running, Yoga, Swimming, etc.intellectualAndLearning- Reading, Chess, Astronomy, etc.techAndGaming- Coding, Gaming, VR, etc.musicAndPerformance- Instruments, Singing, DJing, etc.collecting- Coins, Vinyl, Comics, etc.foodAndDrink- Cooking, Brewing, Mixology, etc.socialAndCommunity- Volunteering, Board Games, etc.relaxationAndMindfulness- Meditation, Journaling, etc.
API Reference
Default Export
The complete categorized hobbies object:
{
creativeAndArtistic: string[],
outdoorAndAdventure: string[],
sportsAndFitness: string[];
intellectualAndLearning: string[];
techAndGaming: string[];
musicAndPerformance: string[];
collecting: string[];
foodAndDrink: string[];
socialAndCommunity: string[];
relaxationAndMindfulness: string[];
}Utility Functions
| Function | Description | Example |
|----------|-------------|---------|
| getAllCategories() | Returns all category names | ['creativeAndArtistic', ...] |
| getHobbiesByCategory(category) | Returns hobbies for specific category | getHobbiesByCategory('techAndGaming') |
| getRandomHobby(category?) | Returns random hobby (optionally filtered by category) | getRandomHobby('foodAndDrink') |
Example Implementations
React Form Component
import { useState } from 'react';
import hobbies from 'hobby-by-category';
function HobbyForm() {
const [category, setCategory] = useState('');
const [hobby, setHobby] = useState('');
return (
<form>
<label>Category:
<select value={category} onChange={e => setCategory(e.target.value)}>
<option value="">Select a category</option>
{hobbies.getAllCategories().map(cat => (
<option key={cat} value={cat}>{cat}</option>
))}
</select>
</label>
<label>Hobby:
<select
value={hobby}
onChange={e => setHobby(e.target.value)}
disabled={!category}
>
<option value="">Select a hobby</option>
{category && hobbies.getHobbiesByCategory(category).map(h => (
<option key={h} value={h}>{h}</option>
))}
</select>
</label>
</form>
);
}Node.js Form Processing
const hobbies = require('hobby-by-category');
app.post('/profile', (req, res) => {
const { category, hobby } = req.body;
if (!hobbies.getHobbiesByCategory(category).includes(hobby)) {
return res.status(400).send('Invalid hobby selection');
}
// Save valid hobby to profile
});Development
Building from Source
git clone https://github.com/therealMAO247/hobby-by-category.git
cd hobby-by-category
npm install
npm run buildTesting
npm testContributing
Contributions are welcome! Please:
- Fork the repository
- Create a new branch for your feature
- Submit a pull request
License
MIT © 2025, Michael Anan Onimisi <@therealMAO247>. MIT © 2025, Ahoiza Techbologies <www.ahoizatechnologies.com>.
