Simpsonize Me - Simpsons Quote Generator
D'oh! Get random quotes from your favorite Simpsons characters with this simple and fun Node.js package.
Installation
npm install simpsonize-me
Usage
const simpsons = require('simpsonize-me');
// Get a random quote from any character
const randomQuote = simpsons.getRandomQuote();
console.log(`${randomQuote.characterDisplay}: "${randomQuote.quote}"`);
// Output: Homer: "D'oh!"
// Get a quote from a specific character
const homerQuote = simpsons.getRandomQuote('homer');
console.log(`${homerQuote.characterDisplay}: "${homerQuote.quote}"`);
// Output: Homer: "Mmm... beer."
// Get multiple random quotes
const quotes = simpsons.getMultipleQuotes(3);
quotes.forEach(q => console.log(`${q.characterDisplay}: "${q.quote}"`));
// Search for quotes containing specific words
const beerQuotes = simpsons.searchQuotes('beer');
console.log(beerQuotes);
// Get all available characters
const characters = simpsons.getAvailableCharacters();
console.log(characters);
// Output: ['homer', 'bart', 'marge', 'lisa', 'moe', 'burns', 'ned']
// Get all quotes from a specific character
const allHomerQuotes = simpsons.getCharacterQuotes('homer');
console.log(allHomerQuotes);
Available Characters
- Homer Simpson - The lovable oaf with a passion for beer and donuts
- Bart Simpson - The mischievous 10-year-old troublemaker
- Marge Simpson - The patient and caring mother of the family
- Lisa Simpson - The intelligent and idealistic 8-year-old
- Moe Szyslak - The gruff bartender of Moe's Tavern
- Mr. Burns - The evil and wealthy owner of the nuclear plant
- Ned Flanders - The overly cheerful Christian neighbor
API Reference
getRandomQuote(character)
Returns a random quote object.
Parameters:
character
(string, optional) - Character name (homer, bart, marge, lisa, moe, burns, ned)
Returns:
{
quote: "D'oh!",
character: "homer",
characterDisplay: "Homer"
}
getMultipleQuotes(count, character)
Returns an array of random quote objects.
Parameters:
count
(number, optional) - Number of quotes to return (default: 5, max: 20)character
(string, optional) - Character name to filter by
searchQuotes(keyword)
Search for quotes containing a specific keyword.
Parameters:
keyword
(string) - The word or phrase to search for
Returns: Array of matching quote objects
getAvailableCharacters()
Returns an array of all available character names.
getCharacterQuotes(character)
Returns an array of all quotes for a specific character.
Parameters:
character
(string) - Character name
Examples
const simpsons = require('simpsonize-me');
// Daily Simpsons wisdom
console.log("Today's Simpsons wisdom:");
const dailyQuote = simpsons.getRandomQuote();
console.log(`${dailyQuote.characterDisplay} says: "${dailyQuote.quote}"`);
// Homer Simpson quote collection
console.log("\nHomer's greatest hits:");
const homerQuotes = simpsons.getMultipleQuotes(3, 'homer');
homerQuotes.forEach((quote, index) => {
console.log(`${index + 1}. "${quote.quote}"`);
});
// Find all beer-related quotes
console.log("\nBeer wisdom:");
const beerQuotes = simpsons.searchQuotes('beer');
beerQuotes.forEach(quote => {
console.log(`${quote.characterDisplay}: "${quote.quote}"`);
});
Contributing
Feel free to add more quotes or characters! The Simpsons has been on for over 30 years, so there's plenty of material to work with.
License
MIT
Powered by Simpsonize Me